Class KQueueIoHandler
java.lang.Object
io.netty.channel.kqueue.KQueueIoHandler
- All Implemented Interfaces:
IoHandler
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate final Queue<KQueueIoHandler.DefaultKqueueIoRegistration> private final KQueueEventArrayprivate final KQueueEventArrayprivate final ThreadAwareExecutorprivate static final intprivate static final intprivate final FileDescriptorprivate static final InternalLoggerprivate final NativeArraysprivate longprivate intprivate final LongObjectMap<KQueueIoHandler.DefaultKqueueIoRegistration> private final IntSupplierprivate final SelectStrategyprivate static final AtomicIntegerFieldUpdater<KQueueIoHandler> private int -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateKQueueIoHandler(ThreadAwareExecutor executor, int maxEvents, SelectStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptionprivate static KQueueIoHandleprivate static KQueueIoOpsvoiddestroy()Destroy theIoHandlerand free all its resources.private longprivate static voidbooleanisCompatible(Class<? extends IoHandle> handleType) Returnstrueif the given type is compatible with thisIoHandlerand so can be registered,falseotherwise.private intkqueueWait(int timeoutSec, int timeoutNs) private intkqueueWait(IoHandlerContext context, boolean oldWakeup) private intstatic IoHandlerFactoryReturns a newIoHandlerFactorythat createsKQueueIoHandlerinstances.static IoHandlerFactorynewFactory(int maxEvents, SelectStrategyFactory selectStrategyFactory) Returns a newIoHandlerFactorythat createsKQueueIoHandlerinstances.(package private) intvoidPrepare to destroy thisIoHandler.private voidprivate intprocessReady(int ready) 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.private voidwakeup0()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IoHandler
initialize
-
Field Details
-
logger
-
WAKEN_UP_UPDATER
-
KQUEUE_WAKE_UP_IDENT
private static final int KQUEUE_WAKE_UP_IDENT- See Also:
-
KQUEUE_MAX_TIMEOUT_SECONDS
private static final int KQUEUE_MAX_TIMEOUT_SECONDS- See Also:
-
allowGrowing
private final boolean allowGrowing -
kqueueFd
-
changeList
-
eventList
-
selectStrategy
-
nativeArrays
-
selectNowSupplier
-
executor
-
cancelledRegistrations
-
registrations
-
numChannels
private int numChannels -
nextId
private long nextId -
wakenUp
private volatile int wakenUp
-
-
Constructor Details
-
KQueueIoHandler
-
-
Method Details
-
generateNextId
private long generateNextId() -
newFactory
Returns a newIoHandlerFactorythat createsKQueueIoHandlerinstances. -
newFactory
public static IoHandlerFactory newFactory(int maxEvents, SelectStrategyFactory selectStrategyFactory) Returns a newIoHandlerFactorythat createsKQueueIoHandlerinstances. -
wakeup
-
wakeup0
private void wakeup0() -
kqueueWait
- Throws:
IOException
-
kqueueWaitNow
- Throws:
IOException
-
kqueueWait
- Throws:
IOException
-
processReady
private int processReady(int ready) -
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. Internal events such as wakeups and timer expirations must not be included in this count.
-
processCancelledRegistrations
private void processCancelledRegistrations() -
numRegisteredChannels
int numRegisteredChannels() -
registeredChannelsList
-
handleLoopException
-
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
-
destroy
-
register
-
cast
-
cast
-
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.
-