Class AbstractChannel.WriteSink

    • Method Detail

      • updateBufferReaderOffsets

        public int updateBufferReaderOffsets​(long writtenBytes)
        Update the Buffer.readerOffset() of each buffer and return the number of completely written Buffers.
        Parameters:
        writtenBytes - the number of written bytes.
        Returns:
        the number of completely written buffers.
      • estimatedMaxBytesPerGatheringWrite

        public long estimatedMaxBytesPerGatheringWrite()
        Return the estimated maximum number of bytes that can be written with one gathering write operation.
        Returns:
        number of bytes.
      • currentFlushedMessage

        public Object currentFlushedMessage()
        Return the current message that should be written.
        Returns:
        the first flushed message.
      • complete

        public void complete​(long attemptedBytesWrite,
                             long actualBytesWrite,
                             int messagesWritten,
                             boolean mightContinueWriting)
        Notify of the last write operation and its result.
        Parameters:
        attemptedBytesWrite - The number of bytes the write operation did attempt to write.
        actualBytesWrite - The number of bytes from the previous write operation. This may be negative if a write error occurs.
        messagesWritten - The number of written messages, this can never be greater than numFlushedMessages().
        mightContinueWriting - true if the write loop might continue writing messages, false otherwise
        Throws:
        IllegalStateException - if called after complete(long, long, int, boolean) or complete(long, Throwable, boolean) was called.
      • complete

        public void complete​(long attemptedBytesWrite,
                             Throwable cause,
                             boolean mightContinueWriting)
        Notify of the last write operation and its result.
        Parameters:
        attemptedBytesWrite - The number of bytes the write operation did attempt to write.
        cause - The error that happened during the write operation and can be recovered.
        mightContinueWriting - true if the write loop might continue writing messages, false otherwise.
        Throws:
        IllegalStateException - if called after complete(long, long, int, boolean) or complete(long, Throwable, boolean) was called.