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

pack-priv final Class KQueueEventLoop

extends SingleThreadEventLoop
Class Inheritance
Imports
io.netty.channel.Channel, .EventLoop, .EventLoopGroup, .EventLoopTaskQueueFactory, .SelectStrategy, .SingleThreadEventLoop, io.netty.channel.kqueue.AbstractKQueueChannel.AbstractKQueueUnsafe, io.netty.channel.unix.FileDescriptor, .IovArray, io.netty.util.IntSupplier, io.netty.util.collection.IntObjectHashMap, .IntObjectMap, io.netty.util.concurrent.RejectedExecutionHandler, io.netty.util.internal.ObjectUtil, .PlatformDependent, io.netty.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.io.IOException, java.util.Iterator, .Queue, java.util.concurrent.Executor, java.util.concurrent.atomic.AtomicIntegerFieldUpdater

EventLoop 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 volatile int
private final IovArray
private static final int
private static final int
private final FileDescriptor
private static final InternalLogger
private final IntSupplier
private final SelectStrategy
private static final AtomicIntegerFieldUpdater<KQueueEventLoop>
private volatile int
Inherited from io.netty.channel.SingleThreadEventLoop:
DEFAULT_MAX_PENDING_TASKS

Constructor Summary

AccessConstructor and Description
pack-priv
KQueueEventLoop(EventLoopGroup parent, Executor executor, int maxEvents, SelectStrategy strategy, RejectedExecutionHandler rejectedExecutionHandler, EventLoopTaskQueueFactory taskQueueFactory, EventLoopTaskQueueFactory tailTaskQueueFactory)

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv IovArray
cleanArray()

Return a cleared IovArray that can be used for writes in this EventLoop.

protected void
cleanup()

Overrides io.netty.util.concurrent.SingleThreadEventExecutor.cleanup.

Do nothing, sub-classes may override
private void
pack-priv void
evSet(AbstractKQueueChannel ch, short filter, short flags, int fflags)

public int
getIoRatio()

Returns the percentage of the desired amount of time spent for I/O in the event loop.

private static void
private int
kqueueWait(boolean oldWakeup)

private int
kqueueWait(int timeoutSec, int timeoutNs)

private int
private static Queue<Runnable>
protected Queue<Runnable>
newTaskQueue(int maxPendingTasks)

Overrides io.netty.util.concurrent.SingleThreadEventExecutor.newTaskQueue.

Create a new Queue which will holds the tasks to execute.
private static Queue<Runnable>
newTaskQueue0(int maxPendingTasks)

private void
processReady(int ready)

public int
registeredChannels()

Overrides io.netty.channel.SingleThreadEventLoop.registeredChannels.

Returns the number of Channels registered with this EventLoop or -1 if operation is not supported.
public Iterator<Channel>
pack-priv void
protected void
run()

Implements abstract io.netty.util.concurrent.SingleThreadEventExecutor.run.

Run the tasks in the taskQueue
public void
setIoRatio(int ioRatio)

Sets the percentage of the desired amount of time spent for I/O in the event loop.

protected void
private void
Inherited from io.netty.channel.SingleThreadEventLoop:
afterRunningAllTasksexecuteAfterEventLoopIterationhasTasksnextparentpendingTasksregisterregisterregister

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
ioRatioback to summary
private volatile int ioRatio
iovArrayback to summary
private final IovArray iovArray
KQUEUE_MAX_TIMEOUT_SECONDSback to summary
private static final int KQUEUE_MAX_TIMEOUT_SECONDS
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

Hides io.netty.util.concurrent.SingleThreadEventExecutor.logger.

selectNowSupplierback to summary
private final IntSupplier selectNowSupplier
selectStrategyback to summary
private final SelectStrategy selectStrategy
WAKEN_UP_UPDATERback to summary
private static final AtomicIntegerFieldUpdater<KQueueEventLoop> WAKEN_UP_UPDATER
wakenUpback to summary
private volatile int wakenUp

Constructor Detail

KQueueEventLoopback to summary
pack-priv KQueueEventLoop(EventLoopGroup parent, Executor executor, int maxEvents, SelectStrategy strategy, RejectedExecutionHandler rejectedExecutionHandler, EventLoopTaskQueueFactory taskQueueFactory, EventLoopTaskQueueFactory tailTaskQueueFactory)

Method Detail

addback to summary
pack-priv void add(AbstractKQueueChannel ch)
cleanArrayback to summary
pack-priv IovArray cleanArray()

Return a cleared IovArray that can be used for writes in this EventLoop.

cleanupback to summary
protected void cleanup()

Overrides io.netty.util.concurrent.SingleThreadEventExecutor.cleanup.

Doc from io.netty.util.concurrent.SingleThreadEventExecutor.cleanup.

Do nothing, sub-classes may override

Annotations
@Override
closeAllback to summary
private void closeAll()
evSetback to summary
pack-priv void evSet(AbstractKQueueChannel ch, short filter, short flags, int fflags)
getIoRatioback to summary
public int getIoRatio()

Returns the percentage of the desired amount of time spent for I/O in the event loop.

handleLoopExceptionback to summary
private static void handleLoopException(Throwable t)
kqueueWaitback to summary
private int kqueueWait(boolean oldWakeup) throws IOException
kqueueWaitback to summary
private int kqueueWait(int timeoutSec, int timeoutNs) throws IOException
kqueueWaitNowback to summary
private int kqueueWaitNow() throws IOException
newTaskQueueback to summary
private static Queue<Runnable> newTaskQueue(EventLoopTaskQueueFactory queueFactory)
newTaskQueueback to summary
protected Queue<Runnable> newTaskQueue(int maxPendingTasks)

Overrides io.netty.util.concurrent.SingleThreadEventExecutor.newTaskQueue.

Doc from io.netty.util.concurrent.SingleThreadEventExecutor.newTaskQueue.

Create a new Queue which will holds the tasks to execute. This default implementation will return a LinkedBlockingQueue but if your sub-class of SingleThreadEventExecutor will not do any blocking calls on the this Queue it may make sense to @Override this and return some more performant implementation that does not support blocking operations at all.

Annotations
@Override
newTaskQueue0back to summary
private static Queue<Runnable> newTaskQueue0(int maxPendingTasks)
processReadyback to summary
private void processReady(int ready)
registeredChannelsback to summary
public int registeredChannels()

Overrides io.netty.channel.SingleThreadEventLoop.registeredChannels.

Doc from io.netty.channel.SingleThreadEventLoop.registeredChannels.

Returns the number of Channels registered with this EventLoop or -1 if operation is not supported. The returned value is not guaranteed to be exact accurate and should be viewed as a best effort.

Annotations
@Override
registeredChannelsIteratorback to summary
public Iterator<Channel> registeredChannelsIterator()

Overrides io.netty.channel.SingleThreadEventLoop.registeredChannelsIterator.

Returns:Iterator<Channel>

Doc from io.netty.channel.SingleThreadEventLoop.registeredChannelsIterator.

read-only iterator of active Channels registered with this EventLoop. The returned value is not guaranteed to be exact accurate and should be viewed as a best effort. This method is expected to be called from within event loop.

Annotations
@Override
removeback to summary
pack-priv void remove(AbstractKQueueChannel ch) throws Exception
runback to summary
protected void run()

Implements abstract io.netty.util.concurrent.SingleThreadEventExecutor.run.

Doc from io.netty.util.concurrent.SingleThreadEventExecutor.run.

Run the tasks in the taskQueue

Annotations
@Override
setIoRatioback to summary
public void setIoRatio(int ioRatio)

Sets the percentage of the desired amount of time spent for I/O in the event loop. The default value is 50, which means the event loop will try to spend the same amount of time for I/O as for non-I/O tasks.

wakeupback to summary
protected void wakeup(boolean inEventLoop)

Overrides io.netty.util.concurrent.SingleThreadEventExecutor.wakeup.

Annotations
@Override
wakeupback to summary
private void wakeup()