public final class NioEventLoop extends SingleThreadEventLoop
SingleThreadEventLoop implementation which register the Channel's to a
Selector and so does the multi-plexing of these in the event loop.DEFAULT_MAX_PENDING_TASKS| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
cleanup()
Do nothing, sub-classes may override
|
int |
getIoRatio()
Returns the percentage of the desired amount of time spent for I/O in the event loop.
|
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.
|
protected java.lang.Runnable |
pollTask() |
void |
rebuildSelector()
Replaces the current
Selector of this event loop with newly created Selectors to work
around the infamous epoll 100% CPU bug. |
void |
register(java.nio.channels.SelectableChannel ch,
int interestOps,
NioTask<?> task)
Registers an arbitrary
SelectableChannel, not necessarily created by Netty, to the Selector
of this event loop. |
protected void |
run() |
java.nio.channels.spi.SelectorProvider |
selectorProvider()
|
void |
setIoRatio(int ioRatio)
Sets the percentage of the desired amount of time spent for I/O in the event loop.
|
protected void |
wakeup(boolean inEventLoop) |
next, parent, register, register, wakesUpForTaskaddShutdownHook, addTask, awaitTermination, confirmShutdown, delayNanos, execute, hasTasks, inEventLoop, interruptThread, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isShuttingDown, isTerminated, newTaskQueue, peekTask, reject, removeShutdownHook, removeTask, runAllTasks, runAllTasks, shutdown, shutdownGracefully, takeTask, terminationFuture, threadProperties, updateLastExecutionTimecancelScheduledTasks, hasScheduledTasks, nanoTime, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelayinEventLoop, iterator, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, 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, terminationFuturepublic java.nio.channels.spi.SelectorProvider selectorProvider()
protected 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.public int pendingTasks()
SingleThreadEventExecutorpublic void register(java.nio.channels.SelectableChannel ch,
int interestOps,
NioTask<?> task)
SelectableChannel, not necessarily created by Netty, to the Selector
of this event loop. Once the specified SelectableChannel is registered, the specified task will
be executed by this event loop when the SelectableChannel is ready.public 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.public void rebuildSelector()
Selector of this event loop with newly created Selectors to work
around the infamous epoll 100% CPU bug.protected void run()
run 在类中 SingleThreadEventExecutorprotected void cleanup()
SingleThreadEventExecutorcleanup 在类中 SingleThreadEventExecutorprotected java.lang.Runnable pollTask()
pollTask 在类中 SingleThreadEventExecutorQueue.poll()protected void wakeup(boolean inEventLoop)
wakeup 在类中 SingleThreadEventExecutor