Package io.netty.util.concurrent
Class PromiseNotifier<V,F extends Future<V>>
java.lang.Object
io.netty.util.concurrent.PromiseNotifier<V,F>
- Type Parameters:
V
- the type of value returned by the futureF
- the type of future
- All Implemented Interfaces:
GenericFutureListener<F>
,EventListener
- Direct Known Subclasses:
ChannelPromiseNotifier
public class PromiseNotifier<V,F extends Future<V>>
extends Object
implements GenericFutureListener<F>
GenericFutureListener
implementation which takes other Promise
s
and notifies them on completion.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPromiseNotifier
(boolean logNotifyFailure, Promise<? super V>... promises) Create a new instance.PromiseNotifier
(Promise<? super V>... promises) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic <V,
F extends Future<V>>
Fstatic <V,
F extends Future<V>>
Fvoid
operationComplete
(F future) Invoked when the operation associated with theFuture
has been completed.
-
Field Details
-
logger
-
promises
-
logNotifyFailure
private final boolean logNotifyFailure
-
-
Constructor Details
-
PromiseNotifier
Create a new instance.- Parameters:
promises
- thePromise
s to notify once thisGenericFutureListener
is notified.
-
PromiseNotifier
Create a new instance.- Parameters:
logNotifyFailure
-true
if logging should be done in case notification fails.promises
- thePromise
s to notify once thisGenericFutureListener
is notified.
-
-
Method Details
-
cascade
-
cascade
public static <V,F extends Future<V>> F cascade(boolean logNotifyFailure, F future, Promise<? super V> promise) Link theFuture
andPromise
such that if theFuture
completes thePromise
will be notified. Cancellation is propagated both ways such that if theFuture
is cancelled thePromise
is cancelled and vise-versa.- Type Parameters:
V
- the type of the value.F
- the type of theFuture
- Parameters:
logNotifyFailure
-true
if logging should be done in case notification fails.future
- theFuture
which will be used to listen to for notifying thePromise
.promise
- thePromise
which will be notified- Returns:
- the passed in
Future
-
operationComplete
Description copied from interface:GenericFutureListener
Invoked when the operation associated with theFuture
has been completed.- Specified by:
operationComplete
in interfaceGenericFutureListener<V>
- Parameters:
future
- the sourceFuture
which called this callback- Throws:
Exception
-