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)
Add the given callback to this registry.
|
void |
addFailureCallback(FailureCallback callback)
Add the given failure callback to this registry.
|
void |
addSuccessCallback(SuccessCallback<? super T> callback)
Add the given success callback to this registry.
|
void |
failure(Throwable ex)
Trigger a
FailureCallback.onFailure(Throwable) call on all
added callbacks with the given Throwable . |
void |
success(T result)
Trigger 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 result.result
- the result to trigger the callbacks withpublic void failure(Throwable ex)
FailureCallback.onFailure(Throwable)
call on all
added callbacks with the given Throwable
.ex
- the exception to trigger the callbacks with