T
- the result type returned by this Future's get
methodpublic interface ListenableFuture<T> extends Future<T>
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
.
Modifier and Type | Method and Description |
---|---|
void |
addCallback(ListenableFutureCallback<? super T> callback)
Register the given
ListenableFutureCallback . |
void |
addCallback(SuccessCallback<? super T> successCallback,
FailureCallback failureCallback)
Java 8 lambda-friendly alternative with success and failure callbacks.
|
default CompletableFuture<T> |
completable()
Expose this
ListenableFuture as a JDK CompletableFuture . |
void addCallback(ListenableFutureCallback<? super T> callback)
ListenableFutureCallback
.callback
- the callback to registervoid addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)
successCallback
- the success callbackfailureCallback
- the failure callbackdefault CompletableFuture<T> completable()
ListenableFuture
as a JDK CompletableFuture
.