Class BytesWriteHandler

    • Constructor Detail

      • BytesWriteHandler

        public BytesWriteHandler()
    • Method Detail

      • createWriteOperation

        public WriteOperation createWriteOperation​(SocketChannelContext context,
                                                   java.lang.Object message,
                                                   java.util.function.BiConsumer<java.lang.Void,​java.lang.Exception> listener)
        Description copied from interface: ReadWriteHandler
        This method is called when a message is queued with a channel. It can be called from any thread. This method should validate that the message is a valid type and return a write operation object to be queued with the channel
        Specified by:
        createWriteOperation in interface ReadWriteHandler
        Parameters:
        context - the channel context
        message - the message
        listener - the listener to be called when the message is sent
        Returns:
        the write operation to be queued
      • writeToBytes

        public java.util.List<FlushOperation> writeToBytes​(WriteOperation writeOperation)
        Description copied from interface: ReadWriteHandler
        This method is called on the event loop thread. It should serialize a write operation object to bytes that can be flushed to the raw nio channel.
        Specified by:
        writeToBytes in interface ReadWriteHandler
        Parameters:
        writeOperation - to be converted to bytes
        Returns:
        the operations to flush the bytes to the channel
      • pollFlushOperations

        public java.util.List<FlushOperation> pollFlushOperations()
        Description copied from interface: ReadWriteHandler
        Returns any flush operations that are ready to flush. This exists as a way to check if any flush operations were produced during a read call.
        Specified by:
        pollFlushOperations in interface ReadWriteHandler
        Returns:
        flush operations