Interface ListenableFuture<T>
- Type Parameters:
T- the result type returned by this Future'sgetmethod
- All Superinterfaces:
Future<T>
- All Known Implementing Classes:
AsyncResult,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.
- Since:
- 4.0
- Author:
- Arjen Poutsma, Sebastien Deleuze, Juergen Hoeller
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCallback(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.
-
Method Details
-
addCallback
Register the givenListenableFutureCallback.- Parameters:
callback- the callback to register
-
addCallback
Java 8 lambda-friendly alternative with success and failure callbacks.- Parameters:
successCallback- the success callbackfailureCallback- the failure callback- Since:
- 4.1
-
completable
Expose thisListenableFutureas a JDKCompletableFuture.- Since:
- 5.0
-