类 SettableFutureNotifier<V,F extends ListenableFuture<V>>
java.lang.Object
cn.taketoday.util.concurrent.SettableFutureNotifier<V,F>
- 类型参数:
V- the type of value returned by the futureF- the type of future
- 所有已实现的接口:
FutureListener<F>,EventListener
public class SettableFutureNotifier<V,F extends ListenableFuture<V>>
extends Object
implements FutureListener<F>
FutureListener implementation which takes other SettableFutures
and notifies them on completion.- 从以下版本开始:
- 4.0
- 作者:
- Harry Yang
-
字段概要
字段修饰符和类型字段说明private final SettableFuture<? super V>[]private static final Loggerprivate final boolean -
构造器概要
构造器构造器说明SettableFutureNotifier(boolean logNotifyFailure, SettableFuture<? super V>... futures) Create a new instance.SettableFutureNotifier(SettableFuture<? super V>... futures) Create a new instance. -
方法概要
修饰符和类型方法说明static <V,F extends ListenableFuture<V>>
Fcascade(boolean logNotifyFailure, F future, SettableFuture<? super V> settableFuture) Link theListenableFutureandSettableFuturesuch that if theListenableFuturecompletes theSettableFuturewill be notified.static <V,F extends ListenableFuture<V>>
Fcascade(F future, SettableFuture<? super V> settableFuture) Link theListenableFutureandSettableFuturesuch that if theListenableFuturecompletes theSettableFuturewill be notified.voidoperationComplete(F future) Invoked when the operation associated with theListenableFuturehas been completed.private static voidtryCancel(SettableFuture<?> p, Logger logger) private static voidtryFailure(SettableFuture<?> p, Throwable cause, Logger logger) private static <V> voidtrySuccess(SettableFuture<? super V> p, V result, Logger logger)
-
字段详细资料
-
logger
-
futures
-
logNotifyFailure
private final boolean logNotifyFailure
-
-
构造器详细资料
-
SettableFutureNotifier
Create a new instance.- 参数:
futures- theSettableFutures to notify once thisFutureListeneris notified.
-
SettableFutureNotifier
@SafeVarargs public SettableFutureNotifier(boolean logNotifyFailure, SettableFuture<? super V>... futures) Create a new instance.- 参数:
logNotifyFailure-trueif logging should be done in case notification fails.futures- theSettableFutures to notify once thisFutureListeneris notified.
-
-
方法详细资料
-
cascade
public static <V,F extends ListenableFuture<V>> F cascade(F future, SettableFuture<? super V> settableFuture) Link theListenableFutureandSettableFuturesuch that if theListenableFuturecompletes theSettableFuturewill be notified. Cancellation is propagated both ways such that if theListenableFutureis cancelled theSettableFutureis cancelled and vise-versa.- 类型参数:
V- the type of the value.F- the type of theListenableFuture- 参数:
future- theListenableFuturewhich will be used to listen to for notifying theSettableFuture.settableFuture- theSettableFuturewhich will be notified- 返回:
- the passed in
ListenableFuture
-
cascade
public static <V,F extends ListenableFuture<V>> F cascade(boolean logNotifyFailure, F future, SettableFuture<? super V> settableFuture) Link theListenableFutureandSettableFuturesuch that if theListenableFuturecompletes theSettableFuturewill be notified. Cancellation is propagated both ways such that if theListenableFutureis cancelled theSettableFutureis cancelled and vise-versa.- 类型参数:
V- the type of the value.F- the type of theListenableFuture- 参数:
logNotifyFailure-trueif logging should be done in case notification fails.future- theListenableFuturewhich will be used to listen to for notifying theSettableFuture.settableFuture- theSettableFuturewhich will be notified- 返回:
- the passed in
ListenableFuture
-
operationComplete
从接口复制的说明:FutureListenerInvoked when the operation associated with theListenableFuturehas been completed.- 指定者:
operationComplete在接口中FutureListener<V>- 参数:
future- the sourceListenableFuturewhich called this callback- 抛出:
Exception
-
tryCancel
-
trySuccess
-
tryFailure
-