Mark ListenableFuture as deprecated for removal

Closes gh-33808
This commit is contained in:
Juergen Hoeller
2024-10-29 18:36:40 +01:00
parent c2c6bb25c6
commit 9e3371ef07
53 changed files with 209 additions and 218 deletions

View File

@@ -310,7 +310,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
return new Object[] {event};
}
@SuppressWarnings({"deprecation", "unchecked"})
@SuppressWarnings({"removal", "unchecked"})
protected void handleResult(Object result) {
if (reactiveStreamsPresent && new ReactiveResultHandler().subscribeToPublisher(result)) {
if (logger.isTraceEnabled()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 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.
@@ -31,12 +31,10 @@ import org.springframework.util.concurrent.SuccessCallback;
* A pass-through {@code Future} handle that can be used for method signatures
* which are declared with a {@code Future} return type for asynchronous execution.
*
* <p>As of Spring 4.1, this class implements {@link ListenableFuture}, not just
* <p>As of Spring 4.1, this class implements {@code ListenableFuture}, not just
* plain {@link java.util.concurrent.Future}, along with the corresponding support
* in {@code @Async} processing.
*
* <p>As of Spring 4.2, this class also supports passing execution exceptions back
* to the caller.
* in {@code @Async} processing. As of 7.0, this will be turned back to a plain
* {@code Future} in order to focus on compatibility with existing common usage.
*
* @author Juergen Hoeller
* @author Rossen Stoyanchev
@@ -48,6 +46,7 @@ import org.springframework.util.concurrent.SuccessCallback;
* @deprecated as of 6.0, in favor of {@link CompletableFuture}
*/
@Deprecated(since = "6.0")
@SuppressWarnings("removal")
public class AsyncResult<V> implements ListenableFuture<V> {
@Nullable
@@ -145,7 +144,7 @@ public class AsyncResult<V> implements ListenableFuture<V> {
* @since 4.2
* @see Future#get()
*/
public static <V> ListenableFuture<V> forValue(V value) {
public static <V> org.springframework.util.concurrent.ListenableFuture<V> forValue(V value) {
return new AsyncResult<>(value, null);
}
@@ -157,7 +156,7 @@ public class AsyncResult<V> implements ListenableFuture<V> {
* @since 4.2
* @see ExecutionException
*/
public static <V> ListenableFuture<V> forExecutionException(Throwable ex) {
public static <V> org.springframework.util.concurrent.ListenableFuture<V> forExecutionException(Throwable ex) {
return new AsyncResult<>(null, ex);
}

View File

@@ -62,7 +62,7 @@ import org.springframework.util.concurrent.ListenableFuture;
* @see DefaultManagedTaskExecutor
* @see ThreadPoolTaskExecutor
*/
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
public class ConcurrentTaskExecutor implements AsyncListenableTaskExecutor, SchedulingTaskExecutor {
private static final Executor STUB_EXECUTOR = (task -> {

View File

@@ -41,7 +41,6 @@ import org.springframework.scheduling.support.TaskUtils;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.ErrorHandler;
import org.springframework.util.concurrent.ListenableFuture;
/**
* Adapter that takes a {@code java.util.concurrent.ScheduledExecutorService} and
@@ -219,15 +218,15 @@ public class ConcurrentTaskScheduler extends ConcurrentTaskExecutor implements T
return super.submit(new DelegatingErrorHandlingCallable<>(task, this.errorHandler));
}
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
@Override
public ListenableFuture<?> submitListenable(Runnable task) {
public org.springframework.util.concurrent.ListenableFuture<?> submitListenable(Runnable task) {
return super.submitListenable(TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, false));
}
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
@Override
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
public <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(Callable<T> task) {
return super.submitListenable(new DelegatingErrorHandlingCallable<>(task, this.errorHandler));
}

View File

@@ -44,7 +44,6 @@ import org.springframework.scheduling.support.DelegatingErrorHandlingRunnable;
import org.springframework.scheduling.support.TaskUtils;
import org.springframework.util.Assert;
import org.springframework.util.ErrorHandler;
import org.springframework.util.concurrent.ListenableFuture;
/**
* A simple implementation of Spring's {@link TaskScheduler} interface, using
@@ -270,15 +269,15 @@ public class SimpleAsyncTaskScheduler extends SimpleAsyncTaskExecutor implements
return super.submit(new DelegatingErrorHandlingCallable<>(task, this.errorHandler));
}
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
@Override
public ListenableFuture<?> submitListenable(Runnable task) {
public org.springframework.util.concurrent.ListenableFuture<?> submitListenable(Runnable task) {
return super.submitListenable(TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, false));
}
@SuppressWarnings("deprecation")
@SuppressWarnings("removal")
@Override
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
public <T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(Callable<T> task) {
return super.submitListenable(new DelegatingErrorHandlingCallable<>(task, this.errorHandler));
}

View File

@@ -80,7 +80,7 @@ import org.springframework.util.concurrent.ListenableFutureTask;
* @see ThreadPoolExecutorFactoryBean
* @see ConcurrentTaskExecutor
*/
@SuppressWarnings({"serial", "deprecation"})
@SuppressWarnings({"serial", "removal"})
public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport
implements AsyncListenableTaskExecutor, SchedulingTaskExecutor {

View File

@@ -74,7 +74,7 @@ import org.springframework.util.concurrent.ListenableFutureTask;
* @see ThreadPoolTaskExecutor
* @see SimpleAsyncTaskScheduler
*/
@SuppressWarnings({"serial", "deprecation"})
@SuppressWarnings({"serial", "removal"})
public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
implements AsyncListenableTaskExecutor, SchedulingTaskExecutor, TaskScheduler {