org.springframework.scheduling.annotation

## 类 AsyncResult<V>

- java.lang.Object
- - org.springframework.scheduling.annotation.AsyncResult<V>

- 所有已实现的接口:
    Future<V>, org.springframework.util.concurrent.ListenableFuture<V>

      public class AsyncResult<V>
      extends Object
      implements org.springframework.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.

  As of Spring 4.1, this class implements `ListenableFuture`, not just plain `Future`, along with the corresponding support in `@Async` processing.

  As of Spring 4.2, this class also supports passing execution exceptions back to the caller.

  从以下版本开始:
    3.0
  作者:
    Juergen Hoeller, Rossen Stoyanchev
  另请参阅:
    `Async`, `forValue(Object)`, `forExecutionException(Throwable)`

- - ### 构造器概要

    构造器
    构造器和说明
    `AsyncResult(V value)` Create a new AsyncResult holder.

  - ### 方法概要

    所有方法 静态方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addCallback(org.springframework.util.concurrent.ListenableFutureCallback<? super V> callback)`
    `void` | `addCallback(org.springframework.util.concurrent.SuccessCallback<? super V> successCallback, org.springframework.util.concurrent.FailureCallback failureCallback)`
    `boolean` | `cancel(boolean mayInterruptIfRunning)`
    `CompletableFuture<V>` | `completable()`
    `static <V> org.springframework.util.concurrent.ListenableFuture<V>` | `forExecutionException(Throwable ex)` Create a new async result which exposes the given exception as an `ExecutionException` from `Future.get()`.
    `static <V> org.springframework.util.concurrent.ListenableFuture<V>` | `forValue(V value)` Create a new async result which exposes the given value from `Future.get()`.
    `V` | `get()`
    `V` | `get(long timeout, TimeUnit unit)`
    `boolean` | `isCancelled()`
    `boolean` | `isDone()`

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 构造器详细资料

    - #### 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(org.springframework.util.concurrent.ListenableFutureCallback<? super V> callback)

      指定者:
        `addCallback` 在接口中 `org.springframework.util.concurrent.ListenableFuture<V>`

    - #### addCallback

          public void addCallback(org.springframework.util.concurrent.SuccessCallback<? super V> successCallback,
                                  org.springframework.util.concurrent.FailureCallback failureCallback)

      指定者:
        `addCallback` 在接口中 `org.springframework.util.concurrent.ListenableFuture<V>`

    - #### completable

          public CompletableFuture<V> completable()

      指定者:
        `completable` 在接口中 `org.springframework.util.concurrent.ListenableFuture<V>`

    - #### forValue

          public static <V> org.springframework.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
      从以下版本开始:
        4.2
      另请参阅:
        `Future.get()`

    - #### forExecutionException

          public static <V> org.springframework.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`)
      从以下版本开始:
        4.2
      另请参阅:
        `ExecutionException`