Class DelegatingHandler

    • Method Summary

      Modifier and Type Method Description
      void channelRegistered()
      This method is called when the channel is registered with its selector.
      void close()  
      boolean closeNow()
      This method indicates if the underlying channel should be closed.
      int consumeReads​(InboundChannelBuffer channelBuffer)
      This method handles bytes that have been read from the network.
      WriteOperation createWriteOperation​(SocketChannelContext context, java.lang.Object message, java.util.function.BiConsumer<java.lang.Void,​java.lang.Exception> listener)
      This method is called when a message is queued with a channel.
      java.util.List<FlushOperation> pollFlushOperations()
      Returns any flush operations that are ready to flush.
      java.util.List<FlushOperation> writeToBytes​(WriteOperation writeOperation)
      This method is called on the event loop thread.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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: NioChannelHandler
        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 NioChannelHandler
        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: NioChannelHandler
        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 NioChannelHandler
        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: NioChannelHandler
        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 NioChannelHandler
        Returns:
        flush operations
      • consumeReads

        public int consumeReads​(InboundChannelBuffer channelBuffer)
                         throws java.io.IOException
        Description copied from interface: NioChannelHandler
        This method handles bytes that have been read from the network. It should return the number of bytes consumed so that they can be released.
        Specified by:
        consumeReads in interface NioChannelHandler
        Parameters:
        channelBuffer - of bytes read from the network
        Returns:
        the number of bytes consumed
        Throws:
        java.io.IOException - if an exception occurs
      • closeNow

        public boolean closeNow()
        Description copied from interface: NioChannelHandler
        This method indicates if the underlying channel should be closed.
        Specified by:
        closeNow in interface NioChannelHandler
        Returns:
        if the channel should be closed
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface NioChannelHandler
        Throws:
        java.io.IOException