Interface IoHandle

All Superinterfaces:
java.lang.AutoCloseable
All Known Subinterfaces:
EpollIoHandle, IoUringIoHandle, KQueueIoHandle, LocalIoHandle, NioIoHandle
All Known Implementing Classes:
AbstractEpollChannel.AbstractEpollUnsafe, AbstractEpollServerChannel.EpollServerSocketUnsafe, AbstractEpollStreamChannel.EpollStreamUnsafe, AbstractIoUringChannel.AbstractUringUnsafe, AbstractIoUringServerChannel.UringServerChannelUnsafe, AbstractIoUringStreamChannel.IoUringStreamUnsafe, AbstractKQueueChannel.AbstractKQueueUnsafe, AbstractKQueueServerChannel.KQueueServerSocketUnsafe, AbstractKQueueStreamChannel.KQueueStreamUnsafe, AbstractNioByteChannel.NioByteUnsafe, AbstractNioChannel.AbstractNioUnsafe, AbstractNioMessageChannel.NioMessageUnsafe, EpollDatagramChannel.EpollDatagramChannelUnsafe, EpollDomainDatagramChannel.EpollDomainDatagramChannelUnsafe, EpollDomainSocketChannel.EpollDomainUnsafe, EpollSocketChannel.EpollSocketChannelUnsafe, IoUringDatagramChannel.IoUringDatagramChannelUnsafe, IoUringDomainSocketChannel.IoUringDomainSocketUnsafe, IoUringSocketChannel.IoUringSocketUnsafe, KQueueDatagramChannel.KQueueDatagramChannelUnsafe, KQueueDomainDatagramChannel.KQueueDomainDatagramChannelUnsafe, KQueueDomainSocketChannel.KQueueDomainUnsafe, LocalChannel.LocalUnsafe, LocalServerChannel.LocalServerUnsafe, NioDomainSocketChannel.NioSocketChannelUnsafe, NioSelectableChannelIoHandle, NioSocketChannel.NioSocketChannelUnsafe

public interface IoHandle extends java.lang.AutoCloseable
A handle that can be registered to an IoHandler. All methods must be called from the ThreadAwareExecutor thread (which means ThreadAwareExecutor.isExecutorThread(Thread) must return true).

All the methods are expected to be called from the IoHandler on which this IoHandle was registered via IoHandler.register(IoHandle).

  • Method Details

    • handle

      void handle(IoRegistration registration, IoEvent ioEvent)
      Be called once there is something to handle.
      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.
    • registered

      default void registered()
      Called once this IoHandle was registered and so will start to receive events via handle(IoRegistration, IoEvent).
    • unregistered

      default void unregistered()
      Called once this IoHandle was unregistered and so will not receive any more events via handle(IoRegistration, IoEvent).
    • close

      void close() throws java.lang.Exception
      Called once the IoHandle should be closed. Even once this method is called this handle might still receive events via handle(IoRegistration, IoEvent) (if it was previous be registered and so its registered() method was called) until the unregistered() method is called.
      Specified by:
      close in interface java.lang.AutoCloseable
      Throws:
      java.lang.Exception