Package io.netty.handler.codec.http2
Class Http2CodecUtil.SimpleChannelPromiseAggregator
java.lang.Object
io.netty.util.concurrent.AbstractFuture<Void>
io.netty.util.concurrent.DefaultPromise<Void>
io.netty.channel.DefaultChannelPromise
io.netty.handler.codec.http2.Http2CodecUtil.SimpleChannelPromiseAggregator
- All Implemented Interfaces:
ChannelFlushPromiseNotifier.FlushCheckpoint
,ChannelFuture
,ChannelPromise
,Future<Void>
,Promise<Void>
,Future<Void>
- Enclosing class:
Http2CodecUtil
Provides the ability to associate the outcome of multiple
ChannelPromise
objects into a single ChannelPromise
object.-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Throwable
private boolean
private int
private int
private final ChannelPromise
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleChannelPromiseAggregator
(ChannelPromise promise, Channel c, EventExecutor e) -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
private boolean
private boolean
Signify that no morenewPromise()
allocations will be made.Allocate a new promise which will be used to aggregate the overall success of this promise aggregator.private void
setAggregateFailure
(Throwable cause) setFailure
(Throwable cause) Fail this object if it has not already been failed.private ChannelPromise
setSuccess
(Void result) Marks this future as a success and notifies all listeners.boolean
tryFailure
(Throwable cause) Marks this future as a failure and notifies all listeners.private boolean
boolean
trySuccess
(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 java.util.concurrent.Future
exceptionNow, get, get, isCancelled, isDone, resultNow, state
Methods inherited from interface io.netty.util.concurrent.Promise
setUncancellable
-
Field Details
-
promise
-
expectedCount
private int expectedCount -
doneCount
private int doneCount -
aggregateFailure
-
doneAllocating
private boolean doneAllocating
-
-
Constructor Details
-
SimpleChannelPromiseAggregator
SimpleChannelPromiseAggregator(ChannelPromise promise, Channel c, EventExecutor e)
-
-
Method Details
-
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
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
Description copied from interface:Promise
Marks this future as a failure and notifies all listeners.- Specified by:
tryFailure
in interfacePromise<Void>
- Overrides:
tryFailure
in classDefaultPromise<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
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<Void>
- Overrides:
setFailure
in classDefaultChannelPromise
-
setSuccess
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<Void>
- Overrides:
setSuccess
in classDefaultChannelPromise
-
trySuccess
Description copied from interface:Promise
Marks this future as a success and notifies all listeners.- Specified by:
trySuccess
in interfacePromise<Void>
- Overrides:
trySuccess
in classDefaultPromise<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
-
tryPromise
private boolean tryPromise() -
setAggregateFailure
-