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 multipleChannelPromise
objects into a singleChannelPromise
object.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Throwable
aggregateFailure
private boolean
doneAllocating
private int
doneCount
private int
expectedCount
private ChannelPromise
promise
-
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 boolean
allowFailure()
private boolean
allPromisesDone()
private boolean
awaitingPromises()
ChannelPromise
doneAllocatingPromises()
Signify that no morenewPromise()
allocations will be made.ChannelPromise
newPromise()
Allocate a new promise which will be used to aggregate the overall success of this promise aggregator.private void
setAggregateFailure(java.lang.Throwable cause)
ChannelPromise
setFailure(java.lang.Throwable cause)
Fail this object if it has not already been failed.private ChannelPromise
setPromise()
ChannelPromise
setSuccess(java.lang.Void result)
Marks this future as a success and notifies all listeners.boolean
tryFailure(java.lang.Throwable cause)
Marks this future as a failure and notifies all listeners.private boolean
tryPromise()
boolean
trySuccess(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
-
aggregateFailure
private java.lang.Throwable aggregateFailure
-
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.
null
ifdoneAllocatingPromises()
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:Promise
Marks this future as a failure and notifies all listeners.- Specified by:
tryFailure
in interfacePromise<java.lang.Void>
- Overrides:
tryFailure
in classDefaultPromise<java.lang.Void>
- Returns:
true
if and only if successfully marked this future as a failure. Otherwisefalse
because 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
IllegalStateException
if called multiple times because that may be expected.- Specified by:
setFailure
in interfaceChannelPromise
- Specified by:
setFailure
in interfacePromise<java.lang.Void>
- Overrides:
setFailure
in classDefaultChannelPromise
-
setSuccess
public ChannelPromise setSuccess(java.lang.Void result)
Description copied from interface:Promise
Marks this future as a success and notifies all listeners. If it is success or failed already it will throw anIllegalStateException
.- Specified by:
setSuccess
in interfaceChannelPromise
- Specified by:
setSuccess
in interfacePromise<java.lang.Void>
- Overrides:
setSuccess
in classDefaultChannelPromise
-
trySuccess
public boolean trySuccess(java.lang.Void result)
Description copied from interface:Promise
Marks this future as a success and notifies all listeners.- Specified by:
trySuccess
in interfacePromise<java.lang.Void>
- Overrides:
trySuccess
in classDefaultPromise<java.lang.Void>
- Returns:
true
if and only if successfully marked this future as a success. Otherwisefalse
because 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()
-
setAggregateFailure
private void setAggregateFailure(java.lang.Throwable cause)
-
-