org.springframework.util.concurrent

## 类 ListenableFutureTask<T>

- java.lang.Object
- - java.util.concurrent.FutureTask<T>
  - - org.springframework.util.concurrent.ListenableFutureTask<T>

- 所有已实现的接口:
    Runnable, Future<T>, RunnableFuture<T>, ListenableFuture<T>

      public class ListenableFutureTask<T>
      extends FutureTask<T>
      implements ListenableFuture<T>

  Extension of `FutureTask` that implements `ListenableFuture`.
  从以下版本开始:
    4.0
  作者:
    Arjen Poutsma

- - ### 构造器概要

    构造器
    构造器和说明
    `ListenableFutureTask(Callable<T> callable)` Create a new `ListenableFutureTask` that will, upon running, execute the given `Callable`.
    `ListenableFutureTask(Runnable runnable, T result)` Create a `ListenableFutureTask` that will, upon running, execute the given `Runnable`, and arrange that `FutureTask.get()` will return the given result on successful completion.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `addCallback(ListenableFutureCallback<? super T> callback)` Register the given `ListenableFutureCallback`.
    `void` | `addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)` Java 8 lambda-friendly alternative with success and failure callbacks.
    `CompletableFuture<T>` | `completable()` Expose this `ListenableFuture` as a JDK `CompletableFuture`.
    `protected void` | `done()`

    - ### 从类继承的方法 java.util.concurrent.FutureTask

      `cancel, get, get, isCancelled, isDone, run, runAndReset, set, setException`

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

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

    - ### 从接口继承的方法 java.util.concurrent.Future

      `cancel, get, get, isCancelled, isDone`

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

    - #### ListenableFutureTask

          public ListenableFutureTask(Callable<T> callable)

      Create a new `ListenableFutureTask` that will, upon running, execute the given `Callable`.
      参数:
        `callable` - the callable task

    - #### ListenableFutureTask

          public ListenableFutureTask(Runnable runnable,
                                      @Nullable
                                      T result)

      Create a `ListenableFutureTask` that will, upon running, execute the given `Runnable`, and arrange that `FutureTask.get()` will return the given result on successful completion.
      参数:
        `runnable` - the runnable task
        `result` - the result to return on successful completion

  - ### 方法详细资料

    - #### addCallback

          public void addCallback(ListenableFutureCallback<? super T> callback)

      从接口复制的说明: `ListenableFuture`
      Register the given `ListenableFutureCallback`.
      指定者:
        `addCallback` 在接口中 `ListenableFuture<T>`
      参数:
        `callback` - the callback to register

    - #### addCallback

          public void addCallback(SuccessCallback<? super T> successCallback,
                                  FailureCallback failureCallback)

      从接口复制的说明: `ListenableFuture`
      Java 8 lambda-friendly alternative with success and failure callbacks.
      指定者:
        `addCallback` 在接口中 `ListenableFuture<T>`
      参数:
        `successCallback` - the success callback
        `failureCallback` - the failure callback

    - #### completable

          public CompletableFuture<T> completable()

      从接口复制的说明: `ListenableFuture`
      Expose this `ListenableFuture` as a JDK `CompletableFuture`.
      指定者:
        `completable` 在接口中 `ListenableFuture<T>`

    - #### done

          protected void done()

      覆盖:
        `done` 在类中 `FutureTask<T>`