类 ListenableFutureCallbackRegistry<T>
java.lang.Object
cn.taketoday.util.concurrent.ListenableFutureCallbackRegistry<T>
- 类型参数:
T- the callback result type
Helper class for
ListenableFuture implementations that maintains a
of success and failure callbacks and helps to notify them.
Inspired by com.google.common.util.concurrent.ExecutionList.
- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Sebastien Deleuze, Rossen Stoyanchev
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaddCallback(ListenableFutureCallback<? super T> callback) Add the given callback to this registry.voidaddFailureCallback(FailureCallback callback) Add the given failure callback to this registry.voidaddSuccessCallback(SuccessCallback<? super T> callback) Add the given success callback to this registry.voidTrigger aFailureCallback.onFailure(Throwable)call on all added callbacks with the givenThrowable.voidTrigger aSuccessCallback.onSuccess(Object)call on all added callbacks with the given result.
-
构造器详细资料
-
ListenableFutureCallbackRegistry
public ListenableFutureCallbackRegistry()
-
-
方法详细资料
-
addCallback
Add the given callback to this registry.- 参数:
callback- the callback to add
-
addSuccessCallback
Add the given success callback to this registry.- 参数:
callback- the success callback to add- 从以下版本开始:
- 4.0
-
addFailureCallback
Add the given failure callback to this registry.- 参数:
callback- the failure callback to add- 从以下版本开始:
- 4.0
-
success
Trigger aSuccessCallback.onSuccess(Object)call on all added callbacks with the given result.- 参数:
result- the result to trigger the callbacks with
-
failure
Trigger aFailureCallback.onFailure(Throwable)call on all added callbacks with the givenThrowable.- 参数:
ex- the exception to trigger the callbacks with
-