T - the type of this FutureS - the type of the adaptee's Futurepublic abstract class ListenableFutureAdapter<T,S> extends FutureAdapter<T,S> implements ListenableFuture<T>
ListenableFuture parameterized over S into a
ListenableFuture parameterized over T. All methods are delegated to the
adaptee, where FutureAdapter.get(), FutureAdapter.get(long, java.util.concurrent.TimeUnit),
and SuccessCallback.onSuccess(Object) call FutureAdapter.adapt(Object)
on the adaptee's result.| Modifier | Constructor and Description |
|---|---|
protected |
ListenableFutureAdapter(ListenableFuture<S> adaptee)
Construct a new
ListenableFutureAdapter with the given adaptee. |
| Modifier and Type | Method and Description |
|---|---|
void |
addCallback(ListenableFutureCallback<? super T> callback)
Registers the given callback to this
ListenableFuture. |
void |
addCallback(SuccessCallback<? super T> successCallback,
FailureCallback failureCallback)
Registers the given success and failure callbacks to this
ListenableFuture. |
adapt, cancel, get, get, getAdaptee, isCancelled, isDoneprotected ListenableFutureAdapter(ListenableFuture<S> adaptee)
ListenableFutureAdapter with the given adaptee.adaptee - the future to adapt topublic void addCallback(ListenableFutureCallback<? super T> callback)
ListenableFutureListenableFuture. The callback will
be triggered when this Future is complete or, if it is already complete,
immediately.addCallback in interface ListenableFuture<T>callback - the callback to registerpublic void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)
ListenableFutureListenableFuture.
The callback will be triggered when this Future is complete or, if it is
already complete immediately. This is a Java 8 lambdas compliant alternative to
ListenableFuture.addCallback(ListenableFutureCallback).addCallback in interface ListenableFuture<T>successCallback - the success callback to registerfailureCallback - the failure callback to register