Package org.qiunet.utils.async.future
Interface DFuture<V>
- All Superinterfaces:
Future<V>
- All Known Subinterfaces:
DPromise<V>
- All Known Implementing Classes:
DCompletePromise
自定义的Future
- Author:
- qiunet 2020/3/8 11:15
-
Method Summary
Modifier and TypeMethodDescriptionawait()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.boolean是否成功.whenComplete(BiConsumer<? super V, ? super Throwable> action) 实在executor线程调用.
-
Method Details
-
whenComplete
实在executor线程调用. 这里是可以引起线程安全, 需要业务自己处理- Parameters:
action-
-
isSuccess
boolean isSuccess()是否成功.- Returns:
-
await
Waits for this future to be completed.- Throws:
InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
Waits for this future to be completed without interruption. This method catches anInterruptedExceptionand discards it silently. -
await
Waits for this future to be completed within the specified time limit.- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
InterruptedException- if the current thread was interrupted
-
await
Waits for this future to be completed within the specified time limit.- Returns:
trueif and only if the future was completed within the specified time limit- Throws:
InterruptedException- if the current thread was interrupted
-
awaitUninterruptibly
Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Returns:
trueif and only if the future was completed within the specified time limit
-
awaitUninterruptibly
boolean awaitUninterruptibly(long timeoutMillis) Waits for this future to be completed within the specified time limit without interruption. This method catches anInterruptedExceptionand discards it silently.- Returns:
trueif and only if the future was completed within the specified time limit
-