接口 FutureListener<F extends ListenableFuture<?>>
- 类型参数:
F- the future type
- 所有超级接口:
EventListener
- 所有已知子接口:
ProgressiveFutureListener<F>
- 函数接口:
- 这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。
@FunctionalInterface
public interface FutureListener<F extends ListenableFuture<?>>
extends EventListener
Listens to the result of a
ListenableFuture.
The result of the asynchronous operation is notified once this listener
is added by calling ListenableFuture.addListener(FutureListener).- 从以下版本开始:
- 4.0
- 作者:
- Arjen Poutsma, Sebastien Deleuze, Harry Yang
-
方法概要
修饰符和类型方法说明static <V,F extends ListenableFuture<V>>
FutureListener<F>forAdaption(SuccessCallback<V> onSuccess, FailureCallback onFailure) Java 8 lambda-friendly alternative with success and failure callbacks.static <V,F extends ListenableFuture<V>>
FutureListener<F>forFailure(FailureCallback failureCallback) Java 8 lambda-friendly alternative with failure callbacks.voidoperationComplete(F future) Invoked when the operation associated with theListenableFuturehas been completed.
-
方法详细资料
-
operationComplete
Invoked when the operation associated with theListenableFuturehas been completed.- 参数:
future- the sourceListenableFuturewhich called this callback- 抛出:
Throwable
-
forAdaption
static <V,F extends ListenableFuture<V>> FutureListener<F> forAdaption(SuccessCallback<V> onSuccess, @Nullable FailureCallback onFailure) Java 8 lambda-friendly alternative with success and failure callbacks.- 类型参数:
F- ListenableFuture sub-type- 参数:
onSuccess- success callbackonFailure- failure callback
-
forFailure
static <V,F extends ListenableFuture<V>> FutureListener<F> forFailure(FailureCallback failureCallback) Java 8 lambda-friendly alternative with failure callbacks.- 参数:
failureCallback- the failure callback
-