Class AsyncResult<V>
java.lang.Object
org.springframework.scheduling.annotation.AsyncResult<V>
- Type Parameters:
V- the value type
- All Implemented Interfaces:
Future<V>,ListenableFuture<V>
Deprecated.
A pass-through
Future handle that can be used for method signatures
which are declared with a Future return type for asynchronous execution.
As of Spring 4.1, this class implements ListenableFuture, not just
plain Future, along with the corresponding support
in @Async processing. As of 7.0, this will be turned back to a plain
Future in order to focus on compatibility with existing common usage.
- Since:
- 3.0
- Author:
- Juergen Hoeller, Rossen Stoyanchev
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCallback(ListenableFutureCallback<? super V> callback) Deprecated.Register the givenListenableFutureCallback.voidaddCallback(SuccessCallback<? super V> successCallback, FailureCallback failureCallback) Deprecated.Java 8 lambda-friendly alternative with success and failure callbacks.booleancancel(boolean mayInterruptIfRunning) Deprecated.Deprecated.Expose thisListenableFutureas a JDKCompletableFuture.static <V> ListenableFuture<V>Deprecated.Create a new async result which exposes the given exception as anExecutionExceptionfromFuture.get().static <V> ListenableFuture<V>forValue(V value) Deprecated.Create a new async result which exposes the given value fromFuture.get().get()Deprecated.Deprecated.booleanDeprecated.booleanisDone()Deprecated.
-
Constructor Details
-
AsyncResult
Deprecated.Create a new AsyncResult holder.- Parameters:
value- the value to pass through
-
-
Method Details
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) Deprecated. -
isCancelled
public boolean isCancelled()Deprecated.- Specified by:
isCancelledin interfaceFuture<V>
-
isDone
public boolean isDone()Deprecated. -
get
Deprecated.- Specified by:
getin interfaceFuture<V>- Throws:
ExecutionException
-
get
Deprecated.- Specified by:
getin interfaceFuture<V>- Throws:
ExecutionException
-
addCallback
Deprecated.Description copied from interface:ListenableFutureRegister the givenListenableFutureCallback.- Specified by:
addCallbackin interfaceListenableFuture<V>- Parameters:
callback- the callback to register
-
addCallback
public void addCallback(SuccessCallback<? super V> successCallback, FailureCallback failureCallback) Deprecated.Description copied from interface:ListenableFutureJava 8 lambda-friendly alternative with success and failure callbacks.- Specified by:
addCallbackin interfaceListenableFuture<V>- Parameters:
successCallback- the success callbackfailureCallback- the failure callback
-
completable
Deprecated.Description copied from interface:ListenableFutureExpose thisListenableFutureas a JDKCompletableFuture.- Specified by:
completablein interfaceListenableFuture<V>
-
forValue
Deprecated.Create a new async result which exposes the given value fromFuture.get().- Parameters:
value- the value to expose- Since:
- 4.2
- See Also:
-
forExecutionException
Deprecated.Create a new async result which exposes the given exception as anExecutionExceptionfromFuture.get().- Parameters:
ex- the exception to expose (either an pre-builtExecutionExceptionor a cause to be wrapped in anExecutionException)- Since:
- 4.2
- See Also:
-
CompletableFuture