public class SingleThreadIoEventLoop extends SingleThreadEventLoop implements IoEventLoop
IoEventLoop implementation that execute all its submitted tasks in a single thread using the provided
IoHandler.SingleThreadEventLoop.ChannelsReadOnlyIterator<T extends Channel>DEFAULT_MAX_PENDING_TASKS| Modifier | Constructor and Description |
|---|---|
|
SingleThreadIoEventLoop(IoEventLoopGroup parent,
Executor executor,
IoHandler ioHandler)
Creates a new instance
|
|
SingleThreadIoEventLoop(IoEventLoopGroup parent,
Executor executor,
IoHandler ioHandler,
int maxPendingTasks,
io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler,
long maxTaskProcessingQuantumMs)
Creates a new instance
|
protected |
SingleThreadIoEventLoop(IoEventLoopGroup parent,
Executor executor,
IoHandler ioHandler,
Queue<Runnable> taskQueue,
Queue<Runnable> tailTaskQueue,
io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Creates a new instance
|
|
SingleThreadIoEventLoop(IoEventLoopGroup parent,
ThreadFactory threadFactory,
IoHandler ioHandler)
Creates a new instance
|
|
SingleThreadIoEventLoop(IoEventLoopGroup parent,
ThreadFactory threadFactory,
IoHandler ioHandler,
int maxPendingTasks,
io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler,
long maxTaskProcessingQuantumMs)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canSuspend(int state) |
protected void |
cleanup() |
protected IoHandler |
ioHandler() |
boolean |
isCompatible(Class<? extends IoHandle> handleType)
Returns
true if the given type is compatible with this IoEventLoopGroup and so can be registered
to the contained IoEventLoops, false otherwise. |
boolean |
isIoType(Class<? extends IoHandler> handlerType)
|
IoEventLoop |
next()
Return the next
EventLoop to use |
io.netty.util.concurrent.Future<IoRegistration> |
register(IoHandle handle)
|
protected void |
run() |
protected int |
runIo()
Called when IO will be processed for all the
IoHandles on this SingleThreadIoEventLoop. |
protected void |
wakeup(boolean inEventLoop) |
afterRunningAllTasks, executeAfterEventLoopIteration, hasTasks, parent, pendingTasks, register, register, register, registeredChannels, registeredChannelsIteratoraddShutdownHook, addTask, awaitTermination, canSuspend, confirmShutdown, deadlineNanos, delayNanos, execute, inEventLoop, interruptThread, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isShuttingDown, isSuspended, isTerminated, lazyExecute, newTaskQueue, newTaskQueue, peekTask, pollTask, pollTaskFrom, reject, reject, removeShutdownHook, removeTask, runAllTasks, runAllTasks, runAllTasksFrom, runScheduledAndExecutorTasks, shutdown, shutdownGracefully, takeTask, terminationFuture, threadProperties, trySuspend, updateLastExecutionTime, wakesUpForTaskafterScheduledTaskSubmitted, beforeScheduledTaskSubmitted, cancelScheduledTasks, deadlineToDelayNanos, getCurrentTimeNanos, hasScheduledTasks, initialNanoTime, nanoTime, nextScheduledTaskDeadlineNanos, nextScheduledTaskNano, pollScheduledTask, pollScheduledTask, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, validateSchedulediterator, newTaskFor, newTaskFor, runTask, safeExecute, shutdownGracefully, shutdownNow, submit, submit, submitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitparent, register, registerinEventLoop, inEventLoop, isSuspended, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, trySuspendisShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFutureawaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminatedforEach, spliteratorregisterpublic SingleThreadIoEventLoop(IoEventLoopGroup parent, ThreadFactory threadFactory, IoHandler ioHandler)
parent - the parent that holds this IoEventLoop.ioHandler - the IoHandler used to run all IO.threadFactory - the ThreadFactory that is used to create the underlying Thread.public SingleThreadIoEventLoop(IoEventLoopGroup parent, Executor executor, IoHandler ioHandler)
parent - the parent that holds this IoEventLoop.executor - the Executor that is used for dispatching the work.ioHandler - the IoHandler used to run all IO.public SingleThreadIoEventLoop(IoEventLoopGroup parent, ThreadFactory threadFactory, IoHandler ioHandler, int maxPendingTasks, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler, long maxTaskProcessingQuantumMs)
parent - the parent that holds this IoEventLoop.threadFactory - the ThreadFactory that is used to create the underlying
Thread.ioHandler - the IoHandler used to run all IO.maxPendingTasks - the maximum pending tasks that are allowed before
RejectedExecutionHandler.rejected(Runnable,
SingleThreadEventExecutor)
is called to handle it.rejectedExecutionHandler - the RejectedExecutionHandler that handles when more tasks are added
then allowed per maxPendingTasks.maxTaskProcessingQuantumMs - the maximum number of milliseconds that will be spent to run tasks before
trying to run IO again.public SingleThreadIoEventLoop(IoEventLoopGroup parent, Executor executor, IoHandler ioHandler, int maxPendingTasks, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler, long maxTaskProcessingQuantumMs)
parent - the parent that holds this IoEventLoop.ioHandler - the IoHandler used to run all IO.executor - the Executor that is used for dispatching the work.maxPendingTasks - the maximum pending tasks that are allowed before
RejectedExecutionHandler.rejected(Runnable,
SingleThreadEventExecutor)
is called to handle it.rejectedExecutionHandler - the RejectedExecutionHandler that handles when more tasks are added
then allowed per maxPendingTasks.maxTaskProcessingQuantumMs - the maximum number of milliseconds that will be spent to run tasks before
trying to run IO again.protected SingleThreadIoEventLoop(IoEventLoopGroup parent, Executor executor, IoHandler ioHandler, Queue<Runnable> taskQueue, Queue<Runnable> tailTaskQueue, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
parent - the parent that holds this IoEventLoop.executor - the Executor that is used for dispatching the work.ioHandler - the IoHandler used to run all IO.taskQueue - the Queue used for storing pending tasks.tailTaskQueue - the Queue used for storing tail pending tasks.rejectedExecutionHandler - the RejectedExecutionHandler that handles when more tasks are added
then allowed.protected void run()
run in class io.netty.util.concurrent.SingleThreadEventExecutorprotected final IoHandler ioHandler()
protected boolean canSuspend(int state)
canSuspend in class io.netty.util.concurrent.SingleThreadEventExecutorprotected int runIo()
IoHandles on this SingleThreadIoEventLoop.
This method returns the number of IoHandles for which IO was processed.
This method must be called from the EventLoop thread.public IoEventLoop next()
EventLoopGroupEventLoop to usenext in interface EventLoopGroupnext in interface IoEventLoopGroupnext in interface io.netty.util.concurrent.EventExecutorGroupnext in class SingleThreadEventLooppublic final io.netty.util.concurrent.Future<IoRegistration> register(IoHandle handle)
IoEventLoopregister in interface IoEventLoophandle - the IoHandle to register.Future that is notified once the operations completes.protected final void wakeup(boolean inEventLoop)
wakeup in class io.netty.util.concurrent.SingleThreadEventExecutorprotected final void cleanup()
cleanup in class io.netty.util.concurrent.SingleThreadEventExecutorpublic boolean isCompatible(Class<? extends IoHandle> handleType)
IoEventLoopGrouptrue if the given type is compatible with this IoEventLoopGroup and so can be registered
to the contained IoEventLoops, false otherwise.isCompatible in interface IoEventLoopisCompatible in interface IoEventLoopGrouphandleType - the type of the IoHandle.public boolean isIoType(Class<? extends IoHandler> handlerType)
IoEventLoopGroupisIoType in interface IoEventLoopisIoType in interface IoEventLoopGrouphandlerType - the type of the IoHandler.Copyright © 2008–2025 The Netty Project. All rights reserved.