Mark ListenableFuture as deprecated for removal
Closes gh-33808
This commit is contained in:
@@ -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.
|
||||
@@ -18,20 +18,18 @@ package org.springframework.core.task;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
|
||||
/**
|
||||
* Extension of the {@link AsyncTaskExecutor} interface, adding the capability to submit
|
||||
* tasks for {@link ListenableFuture ListenableFutures}.
|
||||
* tasks for {@code ListenableFutures}.
|
||||
*
|
||||
* @author Arjen Poutsma
|
||||
* @since 4.0
|
||||
* @see ListenableFuture
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link AsyncTaskExecutor#submitCompletable(Runnable)} and
|
||||
* {@link AsyncTaskExecutor#submitCompletable(Callable)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public interface AsyncListenableTaskExecutor extends AsyncTaskExecutor {
|
||||
|
||||
/**
|
||||
@@ -42,8 +40,8 @@ public interface AsyncListenableTaskExecutor extends AsyncTaskExecutor {
|
||||
* @throws TaskRejectedException if the given task was not accepted
|
||||
* @deprecated in favor of {@link AsyncTaskExecutor#submitCompletable(Runnable)}
|
||||
*/
|
||||
@Deprecated
|
||||
ListenableFuture<?> submitListenable(Runnable task);
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
org.springframework.util.concurrent.ListenableFuture<?> submitListenable(Runnable task);
|
||||
|
||||
/**
|
||||
* Submit a {@code Callable} task for execution, receiving a {@code ListenableFuture}
|
||||
@@ -54,7 +52,7 @@ public interface AsyncListenableTaskExecutor extends AsyncTaskExecutor {
|
||||
* @throws TaskRejectedException if the given task was not accepted
|
||||
* @deprecated in favor of {@link AsyncTaskExecutor#submitCompletable(Callable)}
|
||||
*/
|
||||
@Deprecated
|
||||
<T> ListenableFuture<T> submitListenable(Callable<T> task);
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
<T> org.springframework.util.concurrent.ListenableFuture<T> submitListenable(Callable<T> task);
|
||||
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.springframework.util.concurrent.ListenableFutureTask;
|
||||
* @see org.springframework.scheduling.concurrent.SimpleAsyncTaskScheduler
|
||||
* @see org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
|
||||
*/
|
||||
@SuppressWarnings({"serial", "deprecation"})
|
||||
@SuppressWarnings({"serial", "removal"})
|
||||
public class SimpleAsyncTaskExecutor extends CustomizableThreadCreator
|
||||
implements AsyncListenableTaskExecutor, Serializable, AutoCloseable {
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -43,7 +43,7 @@ import org.springframework.util.concurrent.ListenableFutureTask;
|
||||
* @see java.util.concurrent.ExecutorService
|
||||
* @see java.util.concurrent.Executors
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
public class TaskExecutorAdapter implements AsyncListenableTaskExecutor {
|
||||
|
||||
private final Executor concurrentExecutor;
|
||||
|
||||
@@ -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.
|
||||
@@ -32,7 +32,8 @@ import java.util.concurrent.TimeoutException;
|
||||
* @param <T> the result type returned by this Future's {@code get} method
|
||||
* @deprecated as of 6.0, with no concrete replacement
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class CompletableToListenableFutureAdapter<T> implements ListenableFuture<T> {
|
||||
|
||||
private final CompletableFuture<T> completableFuture;
|
||||
|
||||
@@ -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 java.util.function.BiConsumer;
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link java.util.concurrent.CompletableFuture#whenComplete(BiConsumer)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@FunctionalInterface
|
||||
public interface FailureCallback {
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.function.BiConsumer;
|
||||
* @param <T> the result type returned by this Future's {@code get} method
|
||||
* @deprecated as of 6.0, in favor of {@link CompletableFuture}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
public interface ListenableFuture<T> extends Future<T> {
|
||||
|
||||
/**
|
||||
@@ -43,7 +43,8 @@ public interface ListenableFuture<T> extends Future<T> {
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link CompletableFuture#whenComplete(BiConsumer)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
void addCallback(ListenableFutureCallback<? super T> callback);
|
||||
|
||||
/**
|
||||
@@ -54,7 +55,8 @@ public interface ListenableFuture<T> extends Future<T> {
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link CompletableFuture#whenComplete(BiConsumer)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback);
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -34,7 +34,8 @@ import org.springframework.lang.Nullable;
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link java.util.concurrent.CompletableFuture}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public abstract class ListenableFutureAdapter<T, S> extends FutureAdapter<T, S> implements ListenableFuture<T> {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -29,7 +29,8 @@ import java.util.function.BiConsumer;
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link java.util.concurrent.CompletableFuture#whenComplete(BiConsumer)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public interface ListenableFutureCallback<T> extends SuccessCallback<T>, FailureCallback {
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -35,7 +35,8 @@ import org.springframework.util.Assert;
|
||||
* @param <T> the callback result type
|
||||
* @deprecated as of 6.0, with no concrete replacement
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class ListenableFutureCallbackRegistry<T> {
|
||||
|
||||
private final Queue<SuccessCallback<? super T>> successCallbacks = new ArrayDeque<>(1);
|
||||
|
||||
@@ -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.
|
||||
@@ -31,7 +31,8 @@ import org.springframework.lang.Nullable;
|
||||
* @param <T> the result type returned by this Future's {@code get} method
|
||||
* @deprecated as of 6.0, with no concrete replacement
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class ListenableFutureTask<T> extends FutureTask<T> implements ListenableFuture<T> {
|
||||
|
||||
private final ListenableFutureCallbackRegistry<T> callbacks = new ListenableFutureCallbackRegistry<>();
|
||||
|
||||
@@ -30,6 +30,7 @@ import reactor.core.publisher.Mono;
|
||||
* @deprecated as of 6.0, in favor of {@link Mono#toFuture()}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@SuppressWarnings("removal")
|
||||
public class MonoToListenableFutureAdapter<T> extends CompletableToListenableFutureAdapter<T> {
|
||||
|
||||
public MonoToListenableFutureAdapter(Mono<T> mono) {
|
||||
|
||||
@@ -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.
|
||||
@@ -38,7 +38,8 @@ import org.springframework.util.Assert;
|
||||
* @param <T> the result type returned by this Future's {@code get} method
|
||||
* @deprecated as of 6.0, in favor of {@link CompletableFuture}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@SuppressWarnings("removal")
|
||||
public class SettableListenableFuture<T> implements ListenableFuture<T> {
|
||||
|
||||
private static final Callable<Object> DUMMY_CALLABLE = () -> {
|
||||
|
||||
@@ -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.
|
||||
@@ -29,7 +29,7 @@ import org.springframework.lang.Nullable;
|
||||
* @deprecated as of 6.0, in favor of
|
||||
* {@link java.util.concurrent.CompletableFuture#whenComplete(BiConsumer)}
|
||||
*/
|
||||
@Deprecated(since = "6.0")
|
||||
@Deprecated(since = "6.0", forRemoval = true)
|
||||
@FunctionalInterface
|
||||
public interface SuccessCallback<T> {
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import static org.mockito.Mockito.verifyNoInteractions;
|
||||
* @author Arjen Poutsma
|
||||
* @author Sebastien Deleuze
|
||||
*/
|
||||
@SuppressWarnings({ "deprecation" })
|
||||
@SuppressWarnings("removal")
|
||||
class ListenableFutureTaskTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
class MonoToListenableFutureAdapterTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.
|
||||
@@ -36,7 +36,7 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
* @author Mattias Severson
|
||||
* @author Juergen Hoeller
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings("removal")
|
||||
class SettableListenableFutureTests {
|
||||
|
||||
private final SettableListenableFuture<String> settableListenableFuture = new SettableListenableFuture<>();
|
||||
|
||||
Reference in New Issue
Block a user