Browse Source

Add remaining @SuppressWarnings("removal") for ListenableFuture

See gh-33780
pull/33827/head
Juergen Hoeller 1 year ago
parent
commit
1255bd1fc9
  1. 16
      spring-context/src/test/java/org/springframework/scheduling/concurrent/AbstractSchedulingTaskExecutorTests.java
  2. 4
      spring-context/src/test/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutorTests.java
  3. 4
      spring-context/src/test/java/org/springframework/scheduling/concurrent/ConcurrentTaskSchedulerTests.java
  4. 4
      spring-context/src/test/java/org/springframework/scheduling/concurrent/DecoratedThreadPoolTaskExecutorTests.java
  5. 3
      spring-context/src/test/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskSchedulerTests.java
  6. 2
      spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutorTests.java
  7. 2
      spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskSchedulerTests.java

16
spring-context/src/test/java/org/springframework/scheduling/concurrent/AbstractSchedulingTaskExecutorTests.java

@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
*/
abstract class AbstractSchedulingTaskExecutorTests {
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
private org.springframework.core.task.AsyncListenableTaskExecutor executor;
protected String testName;
@ -64,7 +64,7 @@ abstract class AbstractSchedulingTaskExecutorTests { @@ -64,7 +64,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
this.executor = buildExecutor();
}
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
protected abstract org.springframework.core.task.AsyncListenableTaskExecutor buildExecutor();
@AfterEach
@ -125,7 +125,7 @@ abstract class AbstractSchedulingTaskExecutorTests { @@ -125,7 +125,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
void submitListenableRunnable() {
TestTask task = new TestTask(this.testName, 1);
// Act
@ -156,7 +156,7 @@ abstract class AbstractSchedulingTaskExecutorTests { @@ -156,7 +156,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
void submitFailingListenableRunnable() {
TestTask task = new TestTask(this.testName, 0);
org.springframework.util.concurrent.ListenableFuture<?> future = executor.submitListenable(task);
@ -185,7 +185,7 @@ abstract class AbstractSchedulingTaskExecutorTests { @@ -185,7 +185,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
void submitListenableRunnableWithGetAfterShutdown() throws Exception {
org.springframework.util.concurrent.ListenableFuture<?> future1 = executor.submitListenable(new TestTask(this.testName, -1));
org.springframework.util.concurrent.ListenableFuture<?> future2 = executor.submitListenable(new TestTask(this.testName, -1));
@ -260,7 +260,7 @@ abstract class AbstractSchedulingTaskExecutorTests { @@ -260,7 +260,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
void submitListenableCallable() {
TestCallable task = new TestCallable(this.testName, 1);
// Act
@ -275,7 +275,7 @@ abstract class AbstractSchedulingTaskExecutorTests { @@ -275,7 +275,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
void submitFailingListenableCallable() {
TestCallable task = new TestCallable(this.testName, 0);
// Act
@ -291,7 +291,7 @@ abstract class AbstractSchedulingTaskExecutorTests { @@ -291,7 +291,7 @@ abstract class AbstractSchedulingTaskExecutorTests {
}
@Test
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
void submitListenableCallableWithGetAfterShutdown() throws Exception {
org.springframework.util.concurrent.ListenableFuture<?> future1 = executor.submitListenable(new TestCallable(this.testName, -1));
org.springframework.util.concurrent.ListenableFuture<?> future2 = executor.submitListenable(new TestCallable(this.testName, -1));

4
spring-context/src/test/java/org/springframework/scheduling/concurrent/ConcurrentTaskExecutorTests.java

@ -41,15 +41,15 @@ class ConcurrentTaskExecutorTests extends AbstractSchedulingTaskExecutorTests { @@ -41,15 +41,15 @@ class ConcurrentTaskExecutorTests extends AbstractSchedulingTaskExecutorTests {
new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
@SuppressWarnings("deprecation")
@Override
@SuppressWarnings("removal")
protected org.springframework.core.task.AsyncListenableTaskExecutor buildExecutor() {
concurrentExecutor.setThreadFactory(new CustomizableThreadFactory(this.threadNamePrefix));
return new ConcurrentTaskExecutor(concurrentExecutor);
}
@Override
@AfterEach
@Override
void shutdownExecutor() {
for (Runnable task : concurrentExecutor.shutdownNow()) {
if (task instanceof Future) {

4
spring-context/src/test/java/org/springframework/scheduling/concurrent/ConcurrentTaskSchedulerTests.java

@ -51,8 +51,8 @@ class ConcurrentTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests { @@ -51,8 +51,8 @@ class ConcurrentTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests {
private final AtomicBoolean taskRun = new AtomicBoolean();
@SuppressWarnings("deprecation")
@Override
@SuppressWarnings("removal")
protected org.springframework.core.task.AsyncListenableTaskExecutor buildExecutor() {
threadFactory.setThreadNamePrefix(this.threadNamePrefix);
scheduler.setTaskDecorator(runnable -> () -> {
@ -62,8 +62,8 @@ class ConcurrentTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests { @@ -62,8 +62,8 @@ class ConcurrentTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests {
return scheduler;
}
@Override
@AfterEach
@Override
void shutdownExecutor() {
for (Runnable task : ((ExecutorService) scheduler.getConcurrentExecutor()).shutdownNow()) {
if (task instanceof Future) {

4
spring-context/src/test/java/org/springframework/scheduling/concurrent/DecoratedThreadPoolTaskExecutorTests.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,7 +26,7 @@ import org.springframework.scheduling.support.TaskUtils; @@ -26,7 +26,7 @@ import org.springframework.scheduling.support.TaskUtils;
class DecoratedThreadPoolTaskExecutorTests extends AbstractSchedulingTaskExecutorTests {
@Override
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
protected org.springframework.core.task.AsyncListenableTaskExecutor buildExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setTaskDecorator(runnable ->

3
spring-context/src/test/java/org/springframework/scheduling/concurrent/SimpleAsyncTaskSchedulerTests.java

@ -44,8 +44,8 @@ class SimpleAsyncTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests @@ -44,8 +44,8 @@ class SimpleAsyncTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests
private final AtomicBoolean taskRun = new AtomicBoolean();
@SuppressWarnings("deprecation")
@Override
@SuppressWarnings("removal")
protected org.springframework.core.task.AsyncListenableTaskExecutor buildExecutor() {
scheduler.setTaskDecorator(runnable -> () -> {
taskRun.set(true);
@ -63,7 +63,6 @@ class SimpleAsyncTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests @@ -63,7 +63,6 @@ class SimpleAsyncTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests
}
@Test
@SuppressWarnings("deprecation")
@Override
void submitListenableRunnableWithGetAfterShutdown() {
// decorated Future cannot be cancelled on shutdown with SimpleAsyncTaskScheduler

2
spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutorTests.java

@ -41,7 +41,7 @@ class ThreadPoolTaskExecutorTests extends AbstractSchedulingTaskExecutorTests { @@ -41,7 +41,7 @@ class ThreadPoolTaskExecutorTests extends AbstractSchedulingTaskExecutorTests {
@Override
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
protected org.springframework.core.task.AsyncListenableTaskExecutor buildExecutor() {
executor.setThreadNamePrefix(this.threadNamePrefix);
executor.setMaxPoolSize(1);

2
spring-context/src/test/java/org/springframework/scheduling/concurrent/ThreadPoolTaskSchedulerTests.java

@ -48,8 +48,8 @@ class ThreadPoolTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests { @@ -48,8 +48,8 @@ class ThreadPoolTaskSchedulerTests extends AbstractSchedulingTaskExecutorTests {
private final AtomicBoolean taskRun = new AtomicBoolean();
@SuppressWarnings("deprecation")
@Override
@SuppressWarnings("removal")
protected org.springframework.core.task.AsyncListenableTaskExecutor buildExecutor() {
scheduler.setTaskDecorator(runnable -> () -> {
taskRun.set(true);

Loading…
Cancel
Save