类 AsyncResult<V>
java.lang.Object
cn.taketoday.scheduling.annotation.AsyncResult<V>
- 类型参数:
V- the value type
- 所有已实现的接口:
cn.taketoday.util.concurrent.ListenableFuture<V>,Future<V>
public class AsyncResult<V>
extends Object
implements cn.taketoday.util.concurrent.ListenableFuture<V>
A pass-through
Future handle that can be used for method signatures
which are declared with a Future return type for asynchronous execution.
this class implements ListenableFuture, not just
plain Future, along with the corresponding support
in @Async processing.
this class also supports passing execution exceptions back to the caller.
- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Rossen Stoyanchev
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddCallback(cn.taketoday.util.concurrent.ListenableFutureCallback<? super V> callback) voidaddCallback(cn.taketoday.util.concurrent.SuccessCallback<? super V> successCallback, cn.taketoday.util.concurrent.FailureCallback failureCallback) booleancancel(boolean mayInterruptIfRunning) static <V> cn.taketoday.util.concurrent.ListenableFuture<V>Create a new async result which exposes the given exception as anExecutionExceptionfromFuture.get().static <V> cn.taketoday.util.concurrent.ListenableFuture<V>forValue(V value) Create a new async result which exposes the given value fromFuture.get().get()booleanbooleanisDone()
-
构造器详细资料
-
AsyncResult
Create a new AsyncResult holder.- 参数:
value- the value to pass through
-
-
方法详细资料
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- 指定者:
isCancelled在接口中Future<V>
-
isDone
public boolean isDone() -
get
- 指定者:
get在接口中Future<V>- 抛出:
ExecutionException
-
get
- 指定者:
get在接口中Future<V>- 抛出:
ExecutionException
-
addCallback
- 指定者:
addCallback在接口中cn.taketoday.util.concurrent.ListenableFuture<V>
-
addCallback
public void addCallback(cn.taketoday.util.concurrent.SuccessCallback<? super V> successCallback, cn.taketoday.util.concurrent.FailureCallback failureCallback) - 指定者:
addCallback在接口中cn.taketoday.util.concurrent.ListenableFuture<V>
-
completable
- 指定者:
completable在接口中cn.taketoday.util.concurrent.ListenableFuture<V>
-
forValue
public static <V> cn.taketoday.util.concurrent.ListenableFuture<V> forValue(V value) Create a new async result which exposes the given value fromFuture.get().- 参数:
value- the value to expose- 另请参阅:
-
forExecutionException
public static <V> cn.taketoday.util.concurrent.ListenableFuture<V> forExecutionException(Throwable ex) Create a new async result which exposes the given exception as anExecutionExceptionfromFuture.get().- 参数:
ex- the exception to expose (either an pre-builtExecutionExceptionor a cause to be wrapped in anExecutionException)- 另请参阅:
-