final class KQueueEventLoop extends SingleThreadEventLoop
EventLoop which uses kqueue under the covers. Only works on BSD!| Modifier and Type | Field and Description |
|---|---|
private boolean |
allowGrowing |
private KQueueEventArray |
changeList |
private KQueueEventArray |
eventList |
private int |
ioRatio |
private IovArray |
iovArray |
private NativeLongArray |
jniChannelPointers |
private static int |
KQUEUE_WAKE_UP_IDENT |
private FileDescriptor |
kqueueFd |
private static InternalLogger |
logger |
private java.util.concurrent.Callable<java.lang.Integer> |
pendingTasksCallable |
private IntSupplier |
selectNowSupplier |
private SelectStrategy |
selectStrategy |
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<KQueueEventLoop> |
WAKEN_UP_UPDATER |
private int |
wakenUp |
DEFAULT_MAX_PENDING_TASKS| Constructor and Description |
|---|
KQueueEventLoop(EventLoopGroup parent,
java.util.concurrent.Executor executor,
int maxEvents,
SelectStrategy strategy,
RejectedExecutionHandler rejectedExecutionHandler) |
| Modifier and Type | Method and Description |
|---|---|
(package private) IovArray |
cleanArray()
|
protected void |
cleanup()
Do nothing, sub-classes may override
|
private void |
closeAll() |
private void |
deleteJniChannelPointers() |
(package private) void |
evSet(AbstractKQueueChannel ch,
short filter,
short flags,
int fflags) |
int |
getIoRatio()
Returns the percentage of the desired amount of time spent for I/O in the event loop.
|
private static void |
handleLoopException(java.lang.Throwable t) |
private int |
kqueueWait(boolean oldWakeup) |
private int |
kqueueWait(int timeoutSec,
int timeoutNs) |
private int |
kqueueWaitNow() |
protected java.util.Queue<java.lang.Runnable> |
newTaskQueue(int maxPendingTasks)
Create a new
Queue which will holds the tasks to execute. |
int |
pendingTasks()
Return the number of tasks that are pending for processing.
|
private void |
processReady(int ready) |
(package private) void |
remove(AbstractKQueueChannel ch) |
protected void |
run() |
void |
setIoRatio(int ioRatio)
Sets the percentage of the desired amount of time spent for I/O in the event loop.
|
private void |
wakeup() |
protected void |
wakeup(boolean inEventLoop) |
afterRunningAllTasks, executeAfterEventLoopIteration, hasTasks, next, parent, register, register, register, wakesUpForTaskaddShutdownHook, addTask, awaitTermination, confirmShutdown, delayNanos, execute, inEventLoop, interruptThread, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isShuttingDown, isTerminated, newTaskQueue, peekTask, pollTask, pollTaskFrom, reject, reject, removeShutdownHook, removeTask, runAllTasks, runAllTasks, runAllTasksFrom, shutdown, shutdownGracefully, takeTask, terminationFuture, threadProperties, updateLastExecutionTimecancelScheduledTasks, hasScheduledTasks, nanoTime, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelayinEventLoop, iterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, safeExecute, shutdownGracefully, shutdownNow, submit, submit, submitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinEventLoop, inEventLoop, newFailedFuture, newProgressivePromise, newPromise, newSucceededFutureisShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFutureprivate static final InternalLogger logger
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<KQueueEventLoop> WAKEN_UP_UPDATER
private static final int KQUEUE_WAKE_UP_IDENT
private final NativeLongArray jniChannelPointers
private final boolean allowGrowing
private final FileDescriptor kqueueFd
private final KQueueEventArray changeList
private final KQueueEventArray eventList
private final SelectStrategy selectStrategy
private final IovArray iovArray
private final IntSupplier selectNowSupplier
private final java.util.concurrent.Callable<java.lang.Integer> pendingTasksCallable
private volatile int wakenUp
private volatile int ioRatio
KQueueEventLoop(EventLoopGroup parent, java.util.concurrent.Executor executor, int maxEvents, SelectStrategy strategy, RejectedExecutionHandler rejectedExecutionHandler)
void evSet(AbstractKQueueChannel ch, short filter, short flags, int fflags)
void remove(AbstractKQueueChannel ch) throws java.io.IOException
java.io.IOExceptionIovArray cleanArray()
protected void wakeup(boolean inEventLoop)
wakeup in class SingleThreadEventExecutorprivate void wakeup()
private int kqueueWait(boolean oldWakeup)
throws java.io.IOException
java.io.IOExceptionprivate int kqueueWaitNow()
throws java.io.IOException
java.io.IOExceptionprivate int kqueueWait(int timeoutSec,
int timeoutNs)
throws java.io.IOException
java.io.IOExceptionprivate void deleteJniChannelPointers()
private void processReady(int ready)
protected void run()
run in class SingleThreadEventExecutorprotected java.util.Queue<java.lang.Runnable> newTaskQueue(int maxPendingTasks)
SingleThreadEventExecutorQueue 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.newTaskQueue in class SingleThreadEventExecutorpublic int pendingTasks()
SingleThreadEventExecutorpendingTasks in class SingleThreadEventLooppublic int getIoRatio()
public void setIoRatio(int ioRatio)
50, which means the event loop will try to spend the same amount of time for I/O as for non-I/O tasks.protected void cleanup()
SingleThreadEventExecutorcleanup in class SingleThreadEventExecutorprivate void closeAll()
private static void handleLoopException(java.lang.Throwable t)