-
- All Known Implementing Classes:
EpollHandler
,KQueueHandler
,LocalHandler
,NioHandler
public interface IoHandler
Handles IO dispatching for anEventLoop
All operations exceptwakeup(boolean)
andisCompatible(Class)
MUST be executed on theEventLoop
thread and should never be called from the user-directly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
deregister(IoHandle handle)
Deregister aIoHandle
for IO.void
destroy()
Destroy theIoHandler
and free all its resources.boolean
isCompatible(Class<? extends IoHandle> handleType)
Returnstrue
if the given type is compatible with thisIoHandler
and so can be registered,false
otherwise.void
prepareToDestroy()
Prepare to destroy thisIoHandler
.void
register(IoHandle channel)
Register aChannel
for IO.int
run(IoExecutionContext context)
Run the IO handled by thisIoHandler
.void
wakeup(boolean inEventLoop)
Wakeup theIoHandler
, which means if any operation blocks it should be unblocked and return as soon as possible.
-
-
-
Method Detail
-
run
int run(IoExecutionContext context)
Run the IO handled by thisIoHandler
. TheIoExecutionContext
should be used to ensure we not execute too long and so block the processing of other task that are scheduled on theEventLoop
. This is done by takingIoExecutionContext.delayNanos(long)
orIoExecutionContext.deadlineNanos()
into account.- Returns:
- the number of
IoHandle
for which I/O was handled.
-
prepareToDestroy
void prepareToDestroy()
-
destroy
void destroy()
Destroy theIoHandler
and free all its resources.
-
wakeup
void wakeup(boolean inEventLoop)
Wakeup theIoHandler
, which means if any operation blocks it should be unblocked and return as soon as possible.
-
-