Class NioSelectableChannelIoHandle<S extends java.nio.channels.SelectableChannel>

  • All Implemented Interfaces:
    IoHandle, NioIoHandle, java.lang.AutoCloseable

    public abstract class NioSelectableChannelIoHandle<S extends java.nio.channels.SelectableChannel>
    extends java.lang.Object
    implements IoHandle, NioIoHandle
    Allows to create an IoHandle for a SelectableChannel, not necessarily created by Netty. This IoHandle can be used together with NioIoHandler and so have events dispatched for the SelectableChannel.
    • Constructor Detail

      • NioSelectableChannelIoHandle

        public NioSelectableChannelIoHandle​(S channel)
    • Method Detail

      • handle

        public void handle​(IoRegistration registration,
                           IoEvent ioEvent)
        Description copied from interface: IoHandle
        Be called once there is something to handle.
        Specified by:
        handle in interface IoHandle
        Parameters:
        registration - the IoRegistration for this IoHandle.
        ioEvent - the IoEvent that must be handled. The IoEvent is only valid while this method is executed and so must not escape it.
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.lang.Exception
      • selectableChannel

        public java.nio.channels.SelectableChannel selectableChannel()
        Description copied from interface: NioIoHandle
        The underlying SelectableChannel.
        Specified by:
        selectableChannel in interface NioIoHandle
        Returns:
        the channel
      • handle

        protected abstract void handle​(S channel,
                                       java.nio.channels.SelectionKey key)
      • deregister

        protected void deregister​(S channel)