类 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
另请参阅:
  • 构造器详细资料

    • AsyncResult

      public AsyncResult(@Nullable V value)
      Create a new AsyncResult holder.
      参数:
      value - the value to pass through
  • 方法详细资料

    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      指定者:
      cancel 在接口中 Future<V>
    • isCancelled

      public boolean isCancelled()
      指定者:
      isCancelled 在接口中 Future<V>
    • isDone

      public boolean isDone()
      指定者:
      isDone 在接口中 Future<V>
    • get

      @Nullable public V get() throws ExecutionException
      指定者:
      get 在接口中 Future<V>
      抛出:
      ExecutionException
    • get

      @Nullable public V get(long timeout, TimeUnit unit) throws ExecutionException
      指定者:
      get 在接口中 Future<V>
      抛出:
      ExecutionException
    • addCallback

      public void addCallback(cn.taketoday.util.concurrent.ListenableFutureCallback<? super V> callback)
      指定者:
      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

      public CompletableFuture<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 from Future.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 an ExecutionException from Future.get().
      参数:
      ex - the exception to expose (either an pre-built ExecutionException or a cause to be wrapped in an ExecutionException)
      另请参阅: