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 java., along with the corresponding support
in @Async processing.
As of Spring 4.2, this class also supports passing execution exceptions back to the caller.
Async, forValue(Object), forExecutionException(Throwable)
| Modifier and Type | Field and Description |
|---|---|
| private final Throwable | |
| private final V |
| Access | Constructor and Description |
|---|---|
| public | |
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | addCallback(ListenableFutureCallback<? super V>
the callback to register callback)Implements org.
Deprecated
as a consequence of
Register the given ListenableFutureCallback being deprecated.
ListenableFutureCallback.
|
| public void | addCallback(SuccessCallback<? super V>
the success callback successCallback, FailureCallback the failure callback failureCallback)Implements org.
Deprecated
as a consequence of
Java 8 lambda-friendly alternative with success and failure callbacks.
SuccessCallback and FailureCallback being deprecated.
|
| public boolean | cancel(boolean
true if the thread
executing this task should be interrupted (if the thread is
known to the implementation); otherwise, in-progress tasks are
allowed to completeImplements java. |
| public CompletableFuture | completable()
Overrides default org. ListenableFuture as a JDK CompletableFuture.
|
| private static Throwable | Returns: the exposed exceptionthe original as given to original)forExecutionExceptionDetermine the exposed exception: either the cause of a given
|
| public static <V> ListenableFuture | forExecutionException(Throwable
the exception to expose (either an pre-built ex)ExecutionException
or a cause to be wrapped in an ExecutionException)
Deprecated
as a consequence of
Create a new async result which exposes the given exception as an
ListenableFuture being deprecated.
ExecutionException from Future#get().
|
| public static <V> ListenableFuture | forValue(V
the value to expose value)
Deprecated
as a consequence of
Create a new async result which exposes the given value from ListenableFuture being deprecated.
Future#get().
|
| public V | get()
Implements java. |
| public V | get(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public boolean | isCancelled()
Implements java. true if this task was cancelled before it completed
normally.
|
| public boolean |
| executionException | back to summary |
|---|---|
| private final Throwable executionException
| |
| value | back to summary |
|---|---|
| private final V value
| |
| AsyncResult | back to summary |
|---|---|
| public AsyncResult(V value) Create a new AsyncResult holder.
| |
| AsyncResult | back to summary |
|---|---|
| private AsyncResult(V value, Throwable ex) Create a new AsyncResult holder.
| |
| addCallback | back to summary |
|---|---|
| public void addCallback(ListenableFutureCallback<? super V> callback) Implements org. Doc from org. Deprecated as a consequence of Register the given
| |
| addCallback | back to summary |
|---|---|
| public void addCallback(SuccessCallback<? super V> successCallback, FailureCallback failureCallback) Implements org. Doc from org. Deprecated as a consequence of Java 8 lambda-friendly alternative with success and failure callbacks.
| |
| cancel | back to summary |
|---|---|
| public boolean cancel(boolean mayInterruptIfRunning) Implements java. Doc from java. Attempts to cancel execution of this task. This method has no
effect if the task is already completed or cancelled, or could
not be cancelled for some other reason. Otherwise, if this
task has not started when The return value from this method does not necessarily
indicate whether the task is now cancelled; use
| |
| completable | back to summary |
|---|---|
| public CompletableFuture Overrides default org. Doc from org. Expose this
| |
| exposedException | back to summary |
|---|---|
| private static Throwable exposedException(Throwable original) Determine the exposed exception: either the cause of a given
| |
| forExecutionException | back to summary |
|---|---|
| public static <V> ListenableFuture Deprecated as a consequence of Create a new async result which exposes the given exception as an
| |
| forValue | back to summary |
|---|---|
| public static <V> ListenableFuture Deprecated as a consequence of Create a new async result which exposes the given value from
| |
| get | back to summary |
|---|---|
| public V get() throws ExecutionException Implements java. Doc from java. Waits if necessary for the computation to complete, and then retrieves its result.
| |
| get | back to summary |
|---|---|
| public V get(long timeout, TimeUnit unit) throws ExecutionException Implements java. Doc from java. Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
| |
| isCancelled | back to summary |
|---|---|
| public boolean isCancelled() Implements java. Doc from java. Returns
| |
| isDone | back to summary |
|---|---|
| public boolean isDone() Implements java. Doc from java. Returns
| |