类 CompleteFuture<V>
java.lang.Object
cn.taketoday.util.concurrent.AbstractFuture<V>
cn.taketoday.util.concurrent.CompleteFuture<V>
- 所有已实现的接口:
ListenableFuture<V>,Future<V>
- 直接已知子类:
FailedFuture,SucceededFuture
A skeletal
ListenableFuture implementation which represents
a ListenableFuture which has been completed already.- 从以下版本开始:
- 4.0 2024/2/26 21:28
- 作者:
- Harry Yang
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明addListener(FutureListener<? extends ListenableFuture<V>> listener) Adds the specified listener to this future.addListeners(FutureListener<? extends ListenableFuture<V>>... listeners) Adds the specified listeners to this future.await()Waits for this future to be completed.booleanawait(long timeoutMillis) Waits for this future to be completed within the specified time limit.booleanWaits for this future to be completed within the specified time limit.Waits for this future to be completed without interruption.booleanawaitUninterruptibly(long timeoutMillis) Waits for this future to be completed within the specified time limit without interruption.booleanawaitUninterruptibly(long timeout, TimeUnit unit) Waits for this future to be completed within the specified time limit without interruption.booleancancel(boolean mayInterruptIfRunning) If the cancellation was successful it will fail the future with aCancellationException.protected Executorexecutor()Return theExecutorwhich is used by thisCompleteFuture.booleanbooleanbooleanisDone()removeListener(FutureListener<? extends ListenableFuture<V>> listener) Removes the first occurrence of the specified listener from this future.removeListeners(FutureListener<? extends ListenableFuture<V>>... listeners) Removes the first occurrence for each of the listeners from this future.sync()Waits for this future until it is done, and rethrows the cause of the failure if this future failed.Waits for this future until it is done, and rethrows the cause of the failure if this future failed.从类继承的方法 cn.taketoday.util.concurrent.AbstractFuture
get, get, obtain从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.util.concurrent.ListenableFuture
addListener, completable, getCause, getNow, isSuccess, onFailure, onSuccess
-
字段详细资料
-
executor
-
-
构造器详细资料
-
CompleteFuture
protected CompleteFuture() -
CompleteFuture
Creates a new instance.- 参数:
executor- theExecutorassociated with this future
-
-
方法详细资料
-
executor
Return theExecutorwhich is used by thisCompleteFuture. -
addListener
从接口复制的说明:ListenableFutureAdds 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
从接口复制的说明:ListenableFutureAdds 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
从接口复制的说明:ListenableFutureRemoves 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) 从接口复制的说明:ListenableFutureRemoves 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
从接口复制的说明:ListenableFutureWaits for this future to be completed.- 抛出:
InterruptedException- if the current thread was interrupted
-
await
从接口复制的说明:ListenableFutureWaits for this future to be completed within the specified time limit.- 返回:
trueif and only if the future was completed within the specified time limit- 抛出:
InterruptedException- if the current thread was interrupted
-
sync
从接口复制的说明:ListenableFutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed. -
syncUninterruptibly
从接口复制的说明:ListenableFutureWaits for this future until it is done, and rethrows the cause of the failure if this future failed. -
await
从接口复制的说明:ListenableFutureWaits for this future to be completed within the specified time limit.- 返回:
trueif and only if the future was completed within the specified time limit- 抛出:
InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
从接口复制的说明:ListenableFutureWaits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently. -
awaitUninterruptibly
从接口复制的说明:ListenableFutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- 返回:
trueif and only if the future was completed within the specified time limit
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis) 从接口复制的说明:ListenableFutureWaits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- 返回:
trueif and only if the future was completed within the specified time limit
-
isDone
public boolean isDone() -
isCancellable
public boolean isCancellable()- 返回:
- returns
trueif and only if the operation can be cancelled viaListenableFuture.cancel(boolean).
-
isCancelled
public boolean isCancelled() -
cancel
public boolean cancel(boolean mayInterruptIfRunning) If the cancellation was successful it will fail the future with aCancellationException.- 参数:
mayInterruptIfRunning- this value has no effect in this implementation.
-