public class ListenableFutureCallbackRegistry<T> extends Object
ListenableFutureCallback
instances.
Inspired by com.google.common.util.concurrent.ExecutionList
.
Constructor and Description |
---|
ListenableFutureCallbackRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
addCallback(ListenableFutureCallback<? super T> callback)
Adds the given callback to this registry.
|
void |
addFailureCallback(FailureCallback callback)
Adds the given failure callback to this registry.
|
void |
addSuccessCallback(SuccessCallback<? super T> callback)
Adds the given success callback to this registry.
|
void |
failure(Throwable t)
Triggers a
FailureCallback.onFailure(Throwable) call on all added
callbacks with the given Throwable . |
void |
success(T result)
Triggers a
SuccessCallback.onSuccess(Object) call on all added
callbacks with the given result |
public void addCallback(ListenableFutureCallback<? super T> callback)
callback
- the callback to addpublic void addSuccessCallback(SuccessCallback<? super T> callback)
callback
- the success callback to addpublic void addFailureCallback(FailureCallback callback)
callback
- the failure callback to addpublic void success(T result)
SuccessCallback.onSuccess(Object)
call on all added
callbacks with the given resultresult
- the result to trigger the callbacks withpublic void failure(Throwable t)
FailureCallback.onFailure(Throwable)
call on all added
callbacks with the given Throwable
.t
- the exception to trigger the callbacks with