类 CompleteFuture<V>

java.lang.Object
cn.taketoday.util.concurrent.AbstractFuture<V>
cn.taketoday.util.concurrent.CompleteFuture<V>
所有已实现的接口:
ListenableFuture<V>, Future<V>
直接已知子类:
FailedFuture, SucceededFuture

public abstract class CompleteFuture<V> extends AbstractFuture<V>
A skeletal ListenableFuture implementation which represents a ListenableFuture which has been completed already.
从以下版本开始:
4.0 2024/2/26 21:28
作者:
Harry Yang
  • 字段详细资料

  • 构造器详细资料

    • CompleteFuture

      protected CompleteFuture()
    • CompleteFuture

      protected CompleteFuture(@Nullable Executor executor)
      Creates a new instance.
      参数:
      executor - the Executor associated with this future
  • 方法详细资料

    • executor

      @Nullable protected Executor executor()
      Return the Executor which is used by this CompleteFuture.
    • addListener

      public ListenableFuture<V> addListener(FutureListener<? extends ListenableFuture<V>> listener)
      从接口复制的说明: ListenableFuture
      Adds the specified listener to this future.

      The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.

    • addListeners

      public ListenableFuture<V> addListeners(FutureListener<? extends ListenableFuture<V>>... listeners)
      从接口复制的说明: ListenableFuture
      Adds the specified listeners to this future.

      The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.

    • removeListener

      public ListenableFuture<V> removeListener(FutureListener<? extends ListenableFuture<V>> listener)
      从接口复制的说明: ListenableFuture
      Removes the first occurrence of the specified listener from this future.

      The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.

    • removeListeners

      public ListenableFuture<V> removeListeners(FutureListener<? extends ListenableFuture<V>>... listeners)
      从接口复制的说明: ListenableFuture
      Removes the first occurrence for each of the listeners from this future.

      The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.

    • await

      public ListenableFuture<V> await() throws InterruptedException
      从接口复制的说明: ListenableFuture
      Waits for this future to be completed.
      抛出:
      InterruptedException - if the current thread was interrupted
    • await

      public boolean await(long timeout, TimeUnit unit) throws InterruptedException
      从接口复制的说明: ListenableFuture
      Waits for this future to be completed within the specified time limit.
      返回:
      true if and only if the future was completed within the specified time limit
      抛出:
      InterruptedException - if the current thread was interrupted
    • sync

      public ListenableFuture<V> sync() throws InterruptedException
      从接口复制的说明: ListenableFuture
      Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
      抛出:
      InterruptedException
    • syncUninterruptibly

      public ListenableFuture<V> syncUninterruptibly()
      从接口复制的说明: ListenableFuture
      Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
    • await

      public boolean await(long timeoutMillis) throws InterruptedException
      从接口复制的说明: ListenableFuture
      Waits for this future to be completed within the specified time limit.
      返回:
      true if and only if the future was completed within the specified time limit
      抛出:
      InterruptedException - if the current thread was interrupted
    • awaitUninterruptibly

      public ListenableFuture<V> awaitUninterruptibly()
      从接口复制的说明: ListenableFuture
      Waits for this future to be completed without interruption. This method catches an InterruptedException and discards it silently.
    • awaitUninterruptibly

      public boolean awaitUninterruptibly(long timeout, TimeUnit unit)
      从接口复制的说明: ListenableFuture
      Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.
      返回:
      true if and only if the future was completed within the specified time limit
    • awaitUninterruptibly

      public boolean awaitUninterruptibly(long timeoutMillis)
      从接口复制的说明: ListenableFuture
      Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.
      返回:
      true if and only if the future was completed within the specified time limit
    • isDone

      public boolean isDone()
    • isCancellable

      public boolean isCancellable()
      返回:
      returns true if and only if the operation can be cancelled via ListenableFuture.cancel(boolean).
    • isCancelled

      public boolean isCancelled()
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      If the cancellation was successful it will fail the future with a CancellationException.
      参数:
      mayInterruptIfRunning - this value has no effect in this implementation.