- java.lang.Object
-
- io.netty5.channel.kqueue.KQueueHandler
-
- All Implemented Interfaces:
IoHandler
@UnstableApi public final class KQueueHandler extends Object implements IoHandler
IoHandlerwhich uses kqueue under the covers. Only works on BSD!
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete 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.static IoHandlerFactorynewFactory()Returns a newIoHandlerFactorythat createsKQueueHandlerinstances.static IoHandlerFactorynewFactory(int maxEvents, SelectStrategyFactory selectStrategyFactory)Returns a newIoHandlerFactorythat createsKQueueHandlerinstances.voidprepareToDestroy()Prepare to destroy thisIoHandler.voidregister(IoHandle handle)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
-
newFactory
public static IoHandlerFactory newFactory()
Returns a newIoHandlerFactorythat createsKQueueHandlerinstances.
-
newFactory
public static IoHandlerFactory newFactory(int maxEvents, SelectStrategyFactory selectStrategyFactory)
Returns a newIoHandlerFactorythat createsKQueueHandlerinstances.
-
register
public void register(IoHandle handle)
Description copied from interface:IoHandlerRegister aChannelfor IO.
-
deregister
public void deregister(IoHandle handle) throws Exception
Description copied from interface:IoHandlerDeregister aIoHandlefor IO.- Specified by:
deregisterin interfaceIoHandler- Parameters:
handle- theIoHandleto deregister..- Throws:
Exception- thrown if an error happens during deregistration.
-
wakeup
public void wakeup(boolean inEventLoop)
Description copied from interface:IoHandlerWakeup theIoHandler, which means if any operation blocks it should be unblocked and return as soon as possible.
-
run
public int run(IoExecutionContext context)
Description copied from interface:IoHandlerRun 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.
-
destroy
public void destroy()
Description copied from interface:IoHandlerDestroy theIoHandlerand free all its resources.
-
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
-
isCompatible
public boolean isCompatible(Class<? extends IoHandle> handleType)
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.
-
-