Class Http2CodecUtil.SimpleChannelPromiseAggregator

All Implemented Interfaces:
ChannelFlushPromiseNotifier.FlushCheckpoint, ChannelFuture, ChannelPromise, Future<Void>, Promise<Void>, Future<Void>
Enclosing class:
Http2CodecUtil

static final class Http2CodecUtil.SimpleChannelPromiseAggregator extends DefaultChannelPromise
Provides the ability to associate the outcome of multiple ChannelPromise objects into a single ChannelPromise object.
  • Field Details

    • promise

      private final ChannelPromise promise
    • expectedCount

      private int expectedCount
    • doneCount

      private int doneCount
    • aggregateFailure

      private Throwable aggregateFailure
    • doneAllocating

      private boolean doneAllocating
  • Constructor Details

  • Method Details

    • 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 if doneAllocatingPromises() was previously called.
    • doneAllocatingPromises

      public ChannelPromise doneAllocatingPromises()
      Signify that no more newPromise() 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(Throwable cause)
      Description copied from interface: Promise
      Marks this future as a failure and notifies all listeners.
      Specified by:
      tryFailure in interface Promise<Void>
      Overrides:
      tryFailure in class DefaultPromise<Void>
      Returns:
      true if and only if successfully marked this future as a failure. Otherwise false because this future is already marked as either a success or a failure.
    • setFailure

      public ChannelPromise setFailure(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 interface ChannelPromise
      Specified by:
      setFailure in interface Promise<Void>
      Overrides:
      setFailure in class DefaultChannelPromise
    • setSuccess

      public ChannelPromise setSuccess(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 an IllegalStateException.
      Specified by:
      setSuccess in interface ChannelPromise
      Specified by:
      setSuccess in interface Promise<Void>
      Overrides:
      setSuccess in class DefaultChannelPromise
    • trySuccess

      public boolean trySuccess(Void result)
      Description copied from interface: Promise
      Marks this future as a success and notifies all listeners.
      Specified by:
      trySuccess in interface Promise<Void>
      Overrides:
      trySuccess in class DefaultPromise<Void>
      Returns:
      true if and only if successfully marked this future as a success. Otherwise false 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(Throwable cause)