Interface NioTask<C extends java.nio.channels.SelectableChannel>


public interface NioTask<C extends java.nio.channels.SelectableChannel>
An arbitrary task that can be executed by NioEventLoop when a SelectableChannel becomes ready.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    channelReady(C ch, java.nio.channels.SelectionKey key)
    Invoked when the SelectableChannel has been selected by the Selector.
    void
    channelUnregistered(C ch, java.lang.Throwable cause)
    Invoked when the SelectionKey of the specified SelectableChannel has been cancelled and thus this NioTask will not be notified anymore.
  • Method Details

    • channelReady

      void channelReady(C ch, java.nio.channels.SelectionKey key) throws java.lang.Exception
      Invoked when the SelectableChannel has been selected by the Selector.
      Throws:
      java.lang.Exception
    • channelUnregistered

      void channelUnregistered(C ch, java.lang.Throwable cause) throws java.lang.Exception
      Invoked when the SelectionKey of the specified SelectableChannel has been cancelled and thus this NioTask will not be notified anymore.
      Parameters:
      cause - the cause of the unregistration. null if a user called SelectionKey.cancel() or the event loop has been shut down.
      Throws:
      java.lang.Exception