Class PendingWriteQueue


  • public final class PendingWriteQueue
    extends Object
    A queue of write operations which are pending for later execution.
    • Constructor Detail

      • PendingWriteQueue

        public PendingWriteQueue​(io.netty5.util.concurrent.EventExecutor executor,
                                 MessageSizeEstimator.Handle handle)
    • Method Detail

      • isEmpty

        public boolean isEmpty()
        Returns true if there are no pending write operations left in this queue.
      • size

        public int size()
        Returns the number of pending write operations.
      • bytes

        public long bytes()
        Returns the total number of bytes that are pending because of pending messages. This is only an estimate so it should only be treated as a hint.
      • add

        public void add​(Object msg,
                        io.netty5.util.concurrent.Promise<Void> promise)
        Add the given msg and Promise.
      • removeAndTransferAll

        public io.netty5.util.concurrent.Future<Void> removeAndTransferAll​(Function<Object,​io.netty5.util.concurrent.Future<Void>> transferFunc)
        Remove all pending write operation and performs them via Function.apply(Object).
        Returns:
        Future if something was transferred and null if the PendingWriteQueue is empty.
      • removeAndFailAll

        public void removeAndFailAll​(Throwable cause)
        Remove all pending write operation and fail them with the given Throwable. The message will be released via Resource.dispose(Object).
      • removeAndFail

        public void removeAndFail​(Throwable cause)
        Remove a pending write operation and fail it with the given Throwable. The message will be released via Resource.dispose(Object).
      • removeAndTransfer

        public io.netty5.util.concurrent.Future<Void> removeAndTransfer​(Function<Object,​io.netty5.util.concurrent.Future<Void>> transferFunc)
        Removes a pending write operation and performs it via Function.apply(Object).
        Returns:
        Future if something was transfered and null if the PendingWriteQueue is empty.
      • remove

        public io.netty5.util.concurrent.Promise<Void> remove()
        Removes a pending write operation and release its message via Resource.dispose(Object).
        Returns:
        Promise of the pending write or null if the queue is empty.
      • current

        public Object current()
        Return the current message or null if empty.