Package io.netty.handler.codec.http2
Class Http2CodecUtil.SimpleChannelPromiseAggregator
- java.lang.Object
-
- io.netty.util.concurrent.AbstractFuture<V>
-
- io.netty.util.concurrent.DefaultPromise<java.lang.Void>
-
- io.netty.channel.DefaultChannelPromise
-
- io.netty.handler.codec.http2.Http2CodecUtil.SimpleChannelPromiseAggregator
-
- All Implemented Interfaces:
ChannelFlushPromiseNotifier.FlushCheckpoint,ChannelFuture,ChannelPromise,Future<java.lang.Void>,Promise<java.lang.Void>,java.util.concurrent.Future<java.lang.Void>
- Enclosing class:
- Http2CodecUtil
static final class Http2CodecUtil.SimpleChannelPromiseAggregator extends DefaultChannelPromise
Provides the ability to associate the outcome of multipleChannelPromiseobjects into a singleChannelPromiseobject.
-
-
Field Summary
Fields Modifier and Type Field Description private booleandoneAllocatingprivate intdoneCountprivate intexpectedCountprivate java.lang.ThrowablelastFailureprivate ChannelPromisepromise
-
Constructor Summary
Constructors Constructor Description SimpleChannelPromiseAggregator(ChannelPromise promise, Channel c, EventExecutor e)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanallowFailure()private booleanallPromisesDone()private booleanawaitingPromises()ChannelPromisedoneAllocatingPromises()Signify that no morenewPromise()allocations will be made.ChannelPromisenewPromise()Allocate a new promise which will be used to aggregate the overall success of this promise aggregator.ChannelPromisesetFailure(java.lang.Throwable cause)Fail this object if it has not already been failed.private ChannelPromisesetPromise()ChannelPromisesetSuccess(java.lang.Void result)Marks this future as a success and notifies all listeners.booleantryFailure(java.lang.Throwable cause)Marks this future as a failure and notifies all listeners.private booleantryPromise()booleantrySuccess(java.lang.Void result)Marks this future as a success and notifies all listeners.-
Methods inherited from class io.netty.channel.DefaultChannelPromise
addListener, addListeners, await, awaitUninterruptibly, channel, checkDeadLock, executor, flushCheckpoint, flushCheckpoint, isVoid, promise, removeListener, removeListeners, setSuccess, sync, syncUninterruptibly, trySuccess, unvoid
-
Methods inherited from class io.netty.util.concurrent.DefaultPromise
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, get, get, getNow, isCancellable, isCancelled, isDone, isSuccess, notifyListener, setUncancellable, toString, toStringBuilder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.util.concurrent.Future
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccess
-
Methods inherited from interface io.netty.util.concurrent.Promise
setUncancellable
-
-
-
-
Field Detail
-
promise
private final ChannelPromise promise
-
expectedCount
private int expectedCount
-
doneCount
private int doneCount
-
lastFailure
private java.lang.Throwable lastFailure
-
doneAllocating
private boolean doneAllocating
-
-
Constructor Detail
-
SimpleChannelPromiseAggregator
SimpleChannelPromiseAggregator(ChannelPromise promise, Channel c, EventExecutor e)
-
-
Method Detail
-
newPromise
public ChannelPromise newPromise()
Allocate a new promise which will be used to aggregate the overall success of this promise aggregator.- Returns:
- A new promise which will be aggregated.
nullifdoneAllocatingPromises()was previously called.
-
doneAllocatingPromises
public ChannelPromise doneAllocatingPromises()
Signify that no morenewPromise()allocations will be made. The aggregation can not be successful until this method is called.- Returns:
- The promise that is the aggregation of all promises allocated with
newPromise().
-
tryFailure
public boolean tryFailure(java.lang.Throwable cause)
Description copied from interface:PromiseMarks this future as a failure and notifies all listeners.- Specified by:
tryFailurein interfacePromise<java.lang.Void>- Overrides:
tryFailurein classDefaultPromise<java.lang.Void>- Returns:
trueif and only if successfully marked this future as a failure. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
setFailure
public ChannelPromise setFailure(java.lang.Throwable cause)
Fail this object if it has not already been failed.This method will NOT throw an
IllegalStateExceptionif called multiple times because that may be expected.- Specified by:
setFailurein interfaceChannelPromise- Specified by:
setFailurein interfacePromise<java.lang.Void>- Overrides:
setFailurein classDefaultChannelPromise
-
setSuccess
public ChannelPromise setSuccess(java.lang.Void result)
Description copied from interface:PromiseMarks this future as a success and notifies all listeners. If it is success or failed already it will throw anIllegalStateException.- Specified by:
setSuccessin interfaceChannelPromise- Specified by:
setSuccessin interfacePromise<java.lang.Void>- Overrides:
setSuccessin classDefaultChannelPromise
-
trySuccess
public boolean trySuccess(java.lang.Void result)
Description copied from interface:PromiseMarks this future as a success and notifies all listeners.- Specified by:
trySuccessin interfacePromise<java.lang.Void>- Overrides:
trySuccessin classDefaultPromise<java.lang.Void>- Returns:
trueif and only if successfully marked this future as a success. Otherwisefalsebecause this future is already marked as either a success or a failure.
-
allowFailure
private boolean allowFailure()
-
awaitingPromises
private boolean awaitingPromises()
-
allPromisesDone
private boolean allPromisesDone()
-
setPromise
private ChannelPromise setPromise()
-
tryPromise
private boolean tryPromise()
-
-