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)
Register the given
ListenableFutureCallback. |
void |
addCallback(SuccessCallback<? super T> successCallback,
FailureCallback failureCallback)
Java 8 lambda-friendly alternative with success and failure callbacks.
|
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)
ListenableFutureListenableFutureCallback.addCallback in interface ListenableFuture<T>callback - the callback to registerpublic void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback)
ListenableFutureaddCallback in interface ListenableFuture<T>successCallback - the success callbackfailureCallback - the failure callback