Interface IoHandle
- All Superinterfaces:
AutoCloseable
- All Known Subinterfaces:
EpollIoHandle, IoUringIoHandle, KQueueIoHandle, NioIoHandle
- All Known Implementing Classes:
AbstractNioByteChannel.NioByteUnsafe, AbstractNioChannel.AbstractNioUnsafe, NioSelectableChannelIoHandle
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 Summary
Modifier and TypeMethodDescriptionvoidclose()Called once theIoHandleshould be closed.voidhandle(IoRegistration registration, IoEvent ioEvent) Be called once there is something to handle.default voidCalled once thisIoHandlewas registered and so will start to receive events viahandle(IoRegistration, IoEvent).default voidCalled once thisIoHandlewas unregistered and so will not receive any more events viahandle(IoRegistration, IoEvent).
-
Method Details
-
handle
Be called once there is something to handle.- Parameters:
registration- theIoRegistrationfor thisIoHandle.ioEvent- theIoEventthat must be handled. TheIoEventis only valid while this method is executed and so must not escape it.
-
registered
default void registered()Called once thisIoHandlewas registered and so will start to receive events viahandle(IoRegistration, IoEvent). -
unregistered
default void unregistered()Called once thisIoHandlewas unregistered and so will not receive any more events viahandle(IoRegistration, IoEvent). -
close
Called once theIoHandleshould be closed. Even once this method is called this handle might still receive events viahandle(IoRegistration, IoEvent)(if it was previous be registered and so itsregistered()method was called) until theunregistered()method is called.- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-