接口 ListenableFuture<T>
- 类型参数:
T- the result type returned by this Future'sgetmethod
- 所有超级接口:
Future<T>
- 所有已知实现类:
CompletableToListenableFutureAdapter,ListenableFutureAdapter,ListenableFutureTask,MonoToListenableFutureAdapter,SettableListenableFuture
Extend
Future 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.
in favor of CompletableFuture
- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Sebastien Deleuze, Harry Yang, Juergen Hoeller
-
方法概要
修饰符和类型方法说明voidaddCallback(ListenableFutureCallback<? super T> callback) Register the givenListenableFutureCallback.voidaddCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) Java 8 lambda-friendly alternative with success and failure callbacks.default CompletableFuture<T>Expose thisListenableFutureas a JDKCompletableFuture.
-
方法详细资料
-
addCallback
Register the givenListenableFutureCallback.- 参数:
callback- the callback to register
-
addCallback
Java 8 lambda-friendly alternative with success and failure callbacks.- 参数:
successCallback- the success callbackfailureCallback- the failure callback
-
completable
Expose thisListenableFutureas a JDKCompletableFuture.
-