Class NioIoHandler
java.lang.Object
io.netty.channel.nio.NioIoHandler
- All Implemented Interfaces:
IoHandler
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy theIoHandlerand free all its resources.booleanisCompatible(Class<? extends IoHandle> handleType) Returnstrueif the given type is compatible with thisIoHandlerand so can be registered,falseotherwise.static IoHandlerFactoryReturns a newIoHandlerFactorythat createsNioIoHandlerinstancesstatic IoHandlerFactorynewFactory(SelectorProvider selectorProvider) Returns a newIoHandlerFactorythat createsNioIoHandlerinstances.static IoHandlerFactorynewFactory(SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory) Returns a newIoHandlerFactorythat createsNioIoHandlerinstances.voidPrepare to destroy thisIoHandler.Register aIoHandlefor IO.intrun(IoHandlerContext context) Run the IO handled by thisIoHandler.voidwakeup()Wakeup theIoHandler, which means if any operation blocks it should be unblocked and return as soon as possible.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IoHandler
initialize
-
Method Details
-
selectorProvider
-
register
-
run
Description copied from interface:IoHandlerRun the IO handled by thisIoHandler. TheIoHandlerContextshould be used to ensure we not execute too long and so block the processing of other task that are scheduled on theThreadAwareExecutor. This is done by takingIoHandlerContext.delayNanos(long)orIoHandlerContext.deadlineNanos()into account.- Specified by:
runin interfaceIoHandler- Parameters:
context- theIoHandlerContext.- Returns:
- the number of
IoHandlefor which I/O was handled.
-
destroy
-
prepareToDestroy
public void prepareToDestroy()Description copied from interface:IoHandlerPrepare to destroy thisIoHandler. This method will be called beforeIoHandler.destroy()and may be called multiple times.- Specified by:
prepareToDestroyin interfaceIoHandler
-
wakeup
-
isCompatible
Description copied from interface:IoHandlerReturnstrueif the given type is compatible with thisIoHandlerand so can be registered,falseotherwise.- Specified by:
isCompatiblein interfaceIoHandler- Parameters:
handleType- the type of theIoHandle.- Returns:
- if compatible of not.
-
newFactory
Returns a newIoHandlerFactorythat createsNioIoHandlerinstances- Returns:
- factory the
IoHandlerFactory.
-
newFactory
Returns a newIoHandlerFactorythat createsNioIoHandlerinstances.- Parameters:
selectorProvider- theSelectorProviderto use.- Returns:
- factory the
IoHandlerFactory.
-
newFactory
public static IoHandlerFactory newFactory(SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory) Returns a newIoHandlerFactorythat createsNioIoHandlerinstances.- Parameters:
selectorProvider- theSelectorProviderto use.selectStrategyFactory- theSelectStrategyFactoryto use.- Returns:
- factory the
IoHandlerFactory.
-