public final class NioEventLoop extends SingleThreadEventLoop
SingleThreadEventLoop implementation which registers each Channel with a
NIO Selector and performs the multiplexing of these in the event loop.| Modifier and Type | Method and Description |
|---|---|
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 Queue<Runnable> |
newTaskQueue()
Create a new
Queue which will holds the tasks to execute. |
protected Runnable |
pollTask() |
void |
rebuildSelector()
|
void |
register(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() |
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) |
asInvoker, next, parent, register, register, unwrap, wakesUpForTaskaddShutdownHook, addTask, awaitTermination, cleanupAndTerminate, confirmShutdown, delayNanos, execute, hasTasks, inEventLoop, isShutdown, isShuttingDown, isTerminated, peekTask, pendingTasks, reject, removeShutdownHook, removeTask, runAllTasks, runAllTasks, scheduleExecution, shutdown, shutdownGracefully, takeTask, terminationFuture, updateLastExecutionTimecancelScheduledTasks, hasScheduledTasks, nanoTime, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelaychildren, close, inEventLoop, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, newTaskFor, newTaskFor, shutdownGracefully, shutdownNow, submit, submit, submitinvokeAll, invokeAll, invokeAny, invokeAnyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitchildren, inEventLoop, inEventLoop, newFailedFuture, newProgressivePromise, newPromise, newSucceededFutureisShuttingDown, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFutureawaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminatedcloseprotected Queue<Runnable> newTaskQueue()
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 void register(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()
protected void run()
run in class SingleThreadEventExecutorprotected void cleanup()
SingleThreadEventExecutorcleanup in class SingleThreadEventExecutorprotected Runnable pollTask()
pollTask in class SingleThreadEventExecutorQueue#poll()}protected void wakeup(boolean inEventLoop)
wakeup in class SingleThreadEventExecutorCopyright © 2008–2015 The Netty Project. All rights reserved.