-
- All Known Implementing Classes:
EpollHandler,KQueueHandler,LocalHandler,NioHandler
public interface IoHandlerHandles IO dispatching for anEventLoopAll operations exceptwakeup(boolean)andisCompatible(Class)MUST be executed on theEventLoopthread and should never be called from the user-directly.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidderegister(IoHandle handle)Deregister aIoHandlefor IO.voiddestroy()Destroy theIoHandlerand free all its resources.booleanisCompatible(Class<? extends IoHandle> handleType)Returnstrueif the given type is compatible with thisIoHandlerand so can be registered,falseotherwise.voidprepareToDestroy()Prepare to destroy thisIoHandler.voidregister(IoHandle channel)Register aChannelfor IO.intrun(IoExecutionContext context)Run the IO handled by thisIoHandler.voidwakeup(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. TheIoExecutionContextshould 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
IoHandlefor which I/O was handled.
-
prepareToDestroy
void prepareToDestroy()
-
destroy
void destroy()
Destroy theIoHandlerand 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.
-
-