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.
References Deprecated
ListenableFutureCallback is deprecated or references (maybe indirectly) at least one deprecated element.
Register the given |
| public void | addCallback(SuccessCallback<? super V>
the success callback successCallback, FailureCallback the failure callback failureCallback)Implements org.
References Deprecated
SuccessCallback and FailureCallback are deprecated or reference (maybe indirectly) at least one deprecated element.
Java 8 lambda-friendly alternative with success and failure callbacks. |
| 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. Attempts to cancel execution of this task. |
| public CompletableFuture | completable()
Overrides default org. Expose this |
| 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)
References Deprecated
ListenableFuture is deprecated or references (maybe indirectly) at least one deprecated element.
Create a new async result which exposes the given exception as an
|
| public static <V> ListenableFuture | forValue(V
the value to expose value)
References Deprecated
ListenableFuture is deprecated or references (maybe indirectly) at least one deprecated element.
Create a new async result which exposes the given value from |
| public V | get()
Implements java. Waits if necessary for the computation to complete, and then retrieves its result. |
| public V | get(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available. |
| public boolean | isCancelled()
Implements java. Returns |
| 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. References Deprecated
See corresponding docs for further information. Register the given
| |
| addCallback | back to summary |
|---|---|
| public void addCallback(SuccessCallback<? super V> successCallback, FailureCallback failureCallback) Implements org. Doc from org. References Deprecated
See corresponding docs for further information. 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 References Deprecated
See corresponding docs for further information. Create a new async result which exposes the given exception as an
| |
| forValue | back to summary |
|---|---|
| public static <V> ListenableFuture References Deprecated
See corresponding docs for further information. 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
| |