Top Description Fields Constructors Methods
io.netty.util.concurrent

public Class PromiseNotifier<V, F extends Future<V>>

extends Object
implements GenericFutureListener<F extends Future<V>>
Class Inheritance
All Implemented Interfaces
io.netty.util.concurrent.GenericFutureListener, java.util.EventListener
Type Parameters
<V>
the type of value returned by the future
<F>
the type of future
Imports
io.netty.util.internal.PromiseNotificationUtil, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory

GenericFutureListener implementation which takes other Promises and notifies them on completion.

Field Summary

Modifier and TypeField and Description
private static final InternalLogger
private final boolean
private final Promise<? super V>[]

Constructor Summary

AccessConstructor and Description
public
PromiseNotifier(Promise<? super V>...
the Promises to notify once this GenericFutureListener is notified.
promises
)

Create a new instance.

public
PromiseNotifier(boolean
true if logging should be done in case notification fails.
logNotifyFailure
,
Promise<? super V>...
the Promises to notify once this GenericFutureListener is notified.
promises
)

Create a new instance.

Method Summary

Modifier and TypeMethod and Description
public static <
the type of the value.
V
,
the type of the Future
F extends Future<V>
>
F

Returns:

the passed in Future
cascade
(final F
the Future which will be used to listen to for notifying the Promise.
future
,
final Promise<? super V>
the Promise which will be notified
promise
)

Link the Future and Promise such that if the Future completes the Promise will be notified.

public static <
the type of the value.
V
,
the type of the Future
F extends Future<V>
>
F

Returns:

the passed in Future
cascade
(boolean
true if logging should be done in case notification fails.
logNotifyFailure
,
final F
the Future which will be used to listen to for notifying the Promise.
future
,
final Promise<? super V>
the Promise which will be notified
promise
)

Link the Future and Promise such that if the Future completes the Promise will be notified.

public void
operationComplete(F
the source Future which called this callback
future
)

Implements io.netty.util.concurrent.GenericFutureListener.operationComplete.

Invoked when the operation associated with the Future has been completed.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final InternalLogger logger
logNotifyFailureback to summary
private final boolean logNotifyFailure
promisesback to summary
private final Promise<? super V>[] promises

Constructor Detail

PromiseNotifierback to summary
public PromiseNotifier(Promise<? super V>... promises)

Create a new instance.

Parameters
promises:Promise<? super V>[]

the Promises to notify once this GenericFutureListener is notified.

Annotations
@SafeVarargs
PromiseNotifierback to summary
public PromiseNotifier(boolean logNotifyFailure, Promise<? super V>... promises)

Create a new instance.

Parameters
logNotifyFailure:boolean

true if logging should be done in case notification fails.

promises:Promise<? super V>[]

the Promises to notify once this GenericFutureListener is notified.

Annotations
@SafeVarargs

Method Detail

cascadeback to summary
public static <V, F extends Future<V>> F cascade(final F future, final Promise<? super V> promise)

Link the Future and Promise such that if the Future completes the Promise will be notified. Cancellation is propagated both ways such that if the Future is cancelled the Promise is cancelled and vise-versa.

Parameters
<V>
the type of the value.
<F>
the type of the Future
future:F

the Future which will be used to listen to for notifying the Promise.

promise:Promise<? super V>

the Promise which will be notified

Returns:F

the passed in Future

cascadeback to summary
public static <V, F extends Future<V>> F cascade(boolean logNotifyFailure, final F future, final Promise<? super V> promise)

Link the Future and Promise such that if the Future completes the Promise will be notified. Cancellation is propagated both ways such that if the Future is cancelled the Promise is cancelled and vise-versa.

Parameters
<V>
the type of the value.
<F>
the type of the Future
logNotifyFailure:boolean

true if logging should be done in case notification fails.

future:F

the Future which will be used to listen to for notifying the Promise.

promise:Promise<? super V>

the Promise which will be notified

Returns:F

the passed in Future

Annotations
@SuppressWarnings:unchecked, rawtypes
operationCompleteback to summary
public void operationComplete(F future) throws Exception

Implements io.netty.util.concurrent.GenericFutureListener.operationComplete.

Doc from io.netty.util.concurrent.GenericFutureListener.operationComplete.

Invoked when the operation associated with the Future has been completed.

Parameters
future:F

the source Future which called this callback

Annotations
@Override