public interface IoHandler
IoEventLoop
All operations except wakeup(IoEventLoop) and isCompatible(Class) MUST be executed
on the IoEventLoop thread and should never be called from the user-directly.
Once a IoHandle is registered via the register(IoEventLoop, IoHandle) method it's possible
to submit IoOps related to the IoHandle via IoRegistration.submit(IoOps).
These submitted IoOps are the "source" of IoEvents that are dispatched to the registered
IoHandle via the IoHandle.handle(IoRegistration, IoEvent) method.
These events must be consumed (and handled) as otherwise they might be reported again until handled.
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the
IoHandler and free all its resources. |
boolean |
isCompatible(Class<? extends IoHandle> handleType)
Returns
true if the given type is compatible with this IoHandler and so can be registered,
false otherwise. |
void |
prepareToDestroy()
Prepare to destroy this
IoHandler. |
IoRegistration |
register(IoEventLoop eventLoop,
IoHandle handle)
Register a
IoHandle for IO. |
int |
run(IoExecutionContext context)
Run the IO handled by this
IoHandler. |
void |
wakeup(IoEventLoop eventLoop)
Wakeup the
IoHandler, which means if any operation blocks it should be unblocked and
return as soon as possible. |
int run(IoExecutionContext context)
IoHandler. The IoExecutionContext should be used
to ensure we not execute too long and so block the processing of other task that are
scheduled on the EventLoop. This is done by taking IoExecutionContext.delayNanos(long) or
IoExecutionContext.deadlineNanos() into account.IoHandle for which I/O was handled.void prepareToDestroy()
void destroy()
IoRegistration register(IoEventLoop eventLoop, IoHandle handle) throws Exception
IoHandle for IO.eventLoop - the IoEventLoop that did issue the registration.handle - the IoHandle to register.Exception - thrown if an error happens during registration.void wakeup(IoEventLoop eventLoop)
IoHandler, which means if any operation blocks it should be unblocked and
return as soon as possible.Copyright © 2008–2025 The Netty Project. All rights reserved.