Top Description Fields Constructors Methods
io.netty5.channel.kqueue

public final Class KQueueHandler

extends Object
implements IoHandler
Class Inheritance
All Implemented Interfaces
io.netty5.channel.IoHandler
Annotations
@UnstableApi
Imports
io.netty5.channel.DefaultSelectStrategyFactory, .IoExecutionContext, .IoHandle, .IoHandler, .IoHandlerFactory, .SelectStrategy, .SelectStrategyFactory, io.netty5.channel.unix.FileDescriptor, .IovArray, io.netty5.util.collection.IntObjectHashMap, .IntObjectMap, io.netty5.util.internal.StringUtil, .UnstableApi, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.IOException, .UncheckedIOException, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, java.util.function.IntSupplier

IoHandler which uses kqueue under the covers. Only works on BSD!

Field Summary

Modifier and TypeField and Description
private final boolean
private final KQueueEventArray
private final IntObjectMap<AbstractKQueueChannel<?>>
private final KQueueEventArray
private final IovArray
private static final int
private final FileDescriptor
private static final InternalLogger
private final IntSupplier
private final SelectStrategy
private static final AtomicIntegerFieldUpdater<KQueueHandler>
private volatile int

Constructor Summary

AccessConstructor and Description
private
private
KQueueHandler(int maxEvents, SelectStrategy strategy)

Method Summary

Modifier and TypeMethod and Description
private static AbstractKQueueChannel<?>
cast(IoHandle handle)

private IovArray
public void
deregister(IoHandle
the IoHandle to deregister..
handle
)

Implements io.netty5.channel.IoHandler.deregister.

Deregister a IoHandle for IO.
public void
destroy()

Implements io.netty5.channel.IoHandler.destroy.

Destroy the IoHandler and free all its resources.
private void
evSet(AbstractKQueueChannel<?> ch, short filter, short flags, int fflags)

private static void
public boolean
isCompatible(Class<? extends IoHandle>
the type of the IoHandle.
handleType
)

Implements io.netty5.channel.IoHandler.isCompatible.

Returns true if the given type is compatible with this IoHandler and so can be registered, false otherwise.
private int
kqueueWait(IoExecutionContext context, boolean oldWakeup)

private int
kqueueWait(int timeoutSec, int timeoutNs)

private int
public static IoHandlerFactory
newFactory()

Returns a new IoHandlerFactory that creates KQueueHandler instances.

public static IoHandlerFactory
newFactory(final int maxEvents, final SelectStrategyFactory selectStrategyFactory)

Returns a new IoHandlerFactory that creates KQueueHandler instances.

public void
private void
processReady(int ready)

public void
register(IoHandle
the Channel to register..
handle
)

Implements io.netty5.channel.IoHandler.register.

Register a Channel for IO.
public int
run(IoExecutionContext context)

Implements io.netty5.channel.IoHandler.run.

Run the IO handled by this IoHandler.
public void
wakeup(boolean inEventLoop)

Implements io.netty5.channel.IoHandler.wakeup.

Wakeup the IoHandler, which means if any operation blocks it should be unblocked and return as soon as possible.
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allowGrowingback to summary
private final boolean allowGrowing
changeListback to summary
private final KQueueEventArray changeList
channelsback to summary
private final IntObjectMap<AbstractKQueueChannel<?>> channels
eventListback to summary
private final KQueueEventArray eventList
iovArrayback to summary
private final IovArray iovArray
KQUEUE_WAKE_UP_IDENTback to summary
private static final int KQUEUE_WAKE_UP_IDENT
kqueueFdback to summary
private final FileDescriptor kqueueFd
loggerback to summary
private static final InternalLogger logger
selectNowSupplierback to summary
private final IntSupplier selectNowSupplier
selectStrategyback to summary
private final SelectStrategy selectStrategy
WAKEN_UP_UPDATERback to summary
private static final AtomicIntegerFieldUpdater<KQueueHandler> WAKEN_UP_UPDATER
wakenUpback to summary
private volatile int wakenUp

Constructor Detail

KQueueHandlerback to summary
private KQueueHandler()
KQueueHandlerback to summary
private KQueueHandler(int maxEvents, SelectStrategy strategy)

Method Detail

castback to summary
private static AbstractKQueueChannel<?> cast(IoHandle handle)
cleanArrayback to summary
private IovArray cleanArray()
deregisterback to summary
public void deregister(IoHandle handle) throws Exception

Implements io.netty5.channel.IoHandler.deregister.

Doc from io.netty5.channel.IoHandler.deregister.

Deregister a IoHandle for IO.

Parameters
handle:IoHandle

the IoHandle to deregister..

Annotations
@Override
Exceptions
Exception:
thrown if an error happens during deregistration.
destroyback to summary
public void destroy()

Implements io.netty5.channel.IoHandler.destroy.

Doc from io.netty5.channel.IoHandler.destroy.

Destroy the IoHandler and free all its resources.

Annotations
@Override
evSetback to summary
private void evSet(AbstractKQueueChannel<?> ch, short filter, short flags, int fflags)
handleLoopExceptionback to summary
private static void handleLoopException(Throwable t)
isCompatibleback to summary
public boolean isCompatible(Class<? extends IoHandle> handleType)

Implements io.netty5.channel.IoHandler.isCompatible.

Doc from io.netty5.channel.IoHandler.isCompatible.

Returns true if the given type is compatible with this IoHandler and so can be registered, false otherwise.

Parameters
handleType:Class<? extends IoHandle>

the type of the IoHandle.

Returns:boolean

if compatible of not.

Annotations
@Override
kqueueWaitback to summary
private int kqueueWait(IoExecutionContext context, boolean oldWakeup) throws IOException
kqueueWaitback to summary
private int kqueueWait(int timeoutSec, int timeoutNs) throws IOException
kqueueWaitNowback to summary
private int kqueueWaitNow() throws IOException
newFactoryback to summary
public static IoHandlerFactory newFactory()

Returns a new IoHandlerFactory that creates KQueueHandler instances.

newFactoryback to summary
public static IoHandlerFactory newFactory(final int maxEvents, final SelectStrategyFactory selectStrategyFactory)

Returns a new IoHandlerFactory that creates KQueueHandler instances.

prepareToDestroyback to summary
public void prepareToDestroy()

Implements io.netty5.channel.IoHandler.prepareToDestroy.

Doc from io.netty5.channel.IoHandler.prepareToDestroy.

Prepare to destroy this IoHandler. This method will be called before destroy() and may be called multiple times.

Annotations
@Override
processReadyback to summary
private void processReady(int ready)
registerback to summary
public void register(IoHandle handle)

Implements io.netty5.channel.IoHandler.register.

Doc from io.netty5.channel.IoHandler.register.

Register a Channel for IO.

Parameters
handle:IoHandle

the Channel to register..

Annotations
@Override
runback to summary
public int run(IoExecutionContext context)

Implements io.netty5.channel.IoHandler.run.

Doc from io.netty5.channel.IoHandler.run.

Run the IO handled by this IoHandler. The IoExecutionContext should be used to ensure we not execute too long and so block the processing of other task that are scheduled on the EventLoop. This is done by taking IoExecutionContext#delayNanos(long) or IoExecutionContext#deadlineNanos() into account.

Returns:int

the number of IoHandle for which I/O was handled.

Annotations
@Override
wakeupback to summary
public void wakeup(boolean inEventLoop)

Implements io.netty5.channel.IoHandler.wakeup.

Doc from io.netty5.channel.IoHandler.wakeup.

Wakeup the IoHandler, which means if any operation blocks it should be unblocked and return as soon as possible.

Annotations
@Override
wakeupback to summary
private void wakeup()