接口 ListenableFuture<T>
- 类型参数:
T
- the result type returned by this Future'sget
method
- 所有超级接口:
Future<T>
- 所有已知实现类:
AsyncResult
,CompletableToListenableFutureAdapter
,ListenableFutureAdapter
,ListenableFutureTask
,MonoToListenableFutureAdapter
,SettableListenableFuture
public interface ListenableFuture<T> extends Future<T>
ExtendFuture
with the capability to accept completion callbacks. If the future has completed when the callback is added, the callback is triggered immediately.Inspired by
com.google.common.util.concurrent.ListenableFuture
.- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Sebastien Deleuze, Juergen Hoeller
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 void
addCallback(ListenableFutureCallback<? super T> callback)
Register the givenListenableFutureCallback
.void
addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)
Java 8 lambda-friendly alternative with success and failure callbacks.default CompletableFuture<T>
completable()
Expose thisListenableFuture
as a JDKCompletableFuture
.
方法详细资料
addCallback
void addCallback(ListenableFutureCallback<? super T> callback)
Register the givenListenableFutureCallback
.- 参数:
callback
- the callback to register
addCallback
void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)
Java 8 lambda-friendly alternative with success and failure callbacks.- 参数:
successCallback
- the success callbackfailureCallback
- the failure callback- 从以下版本开始:
- 4.1
completable
default CompletableFuture<T> completable()
Expose thisListenableFuture
as a JDKCompletableFuture
.- 从以下版本开始:
- 5.0