Class SettableListenableFuture<T>
java.lang.Object
org.springframework.util.concurrent.SettableListenableFuture<T>
- Type Parameters:
T
- the result type returned by this Future'sget
method
- All Implemented Interfaces:
Future<T>
,ListenableFuture<T>
@Deprecated(since="6.0",
forRemoval=true)
public class SettableListenableFuture<T>
extends Object
implements ListenableFuture<T>
Deprecated, for removal: This API element is subject to removal in a future version.
A
ListenableFuture
whose value can be set via set(Object)
or setException(Throwable)
. It may also get cancelled.
Inspired by com.google.common.util.concurrent.SettableFuture
.
- Since:
- 4.1
- Author:
- Mattias Severson, Rossen Stoyanchev, Juergen Hoeller
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCallback
(ListenableFutureCallback<? super T> callback) Deprecated, for removal: This API element is subject to removal in a future version.Register the givenListenableFutureCallback
.void
addCallback
(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) Deprecated, for removal: This API element is subject to removal in a future version.Java 8 lambda-friendly alternative with success and failure callbacks.boolean
cancel
(boolean mayInterruptIfRunning) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.Expose thisListenableFuture
as a JDKCompletableFuture
.get()
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve the value.Deprecated, for removal: This API element is subject to removal in a future version.Retrieve the value.protected void
Deprecated, for removal: This API element is subject to removal in a future version.Subclasses can override this method to implement interruption of the future's computation.boolean
Deprecated, for removal: This API element is subject to removal in a future version.boolean
isDone()
Deprecated, for removal: This API element is subject to removal in a future version.boolean
Deprecated, for removal: This API element is subject to removal in a future version.Set the value of this future.boolean
setException
(Throwable exception) Deprecated, for removal: This API element is subject to removal in a future version.Set the exception of this future.
-
Constructor Details
-
SettableListenableFuture
public SettableListenableFuture()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
set
Deprecated, for removal: This API element is subject to removal in a future version.Set the value of this future. This method will returntrue
if the value was set successfully, orfalse
if the future has already been set or cancelled.- Parameters:
value
- the value that will be set- Returns:
true
if the value was successfully set, elsefalse
-
setException
Deprecated, for removal: This API element is subject to removal in a future version.Set the exception of this future. This method will returntrue
if the exception was set successfully, orfalse
if the future has already been set or cancelled.- Parameters:
exception
- the value that will be set- Returns:
true
if the exception was successfully set, elsefalse
-
addCallback
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ListenableFuture
Register the givenListenableFutureCallback
.- Specified by:
addCallback
in interfaceListenableFuture<T>
- Parameters:
callback
- the callback to register
-
addCallback
public void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ListenableFuture
Java 8 lambda-friendly alternative with success and failure callbacks.- Specified by:
addCallback
in interfaceListenableFuture<T>
- Parameters:
successCallback
- the success callbackfailureCallback
- the failure callback
-
completable
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ListenableFuture
Expose thisListenableFuture
as a JDKCompletableFuture
.- Specified by:
completable
in interfaceListenableFuture<T>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Deprecated, for removal: This API element is subject to removal in a future version. -
isCancelled
public boolean isCancelled()Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
isCancelled
in interfaceFuture<T>
-
isDone
public boolean isDone()Deprecated, for removal: This API element is subject to removal in a future version. -
get
Deprecated, for removal: This API element is subject to removal in a future version.Retrieve the value.This method returns the value if it has been set via
set(Object)
, throws anExecutionException
if an exception has been set viasetException(Throwable)
, or throws aCancellationException
if the future has been cancelled.- Specified by:
get
in interfaceFuture<T>
- Returns:
- the value associated with this future
- Throws:
InterruptedException
ExecutionException
-
get
@Nullable public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Deprecated, for removal: This API element is subject to removal in a future version.Retrieve the value.This method returns the value if it has been set via
set(Object)
, throws anExecutionException
if an exception has been set viasetException(Throwable)
, or throws aCancellationException
if the future has been cancelled.- Specified by:
get
in interfaceFuture<T>
- Parameters:
timeout
- the maximum time to waitunit
- the unit of the timeout argument- Returns:
- the value associated with this future
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
interruptTask
protected void interruptTask()Deprecated, for removal: This API element is subject to removal in a future version.Subclasses can override this method to implement interruption of the future's computation. The method is invoked automatically by a successful call tocancel(true)
.The default implementation is empty.
-
CompletableFuture