Class MultiThreadIoEventLoopGroup
java.lang.Object
io.netty.util.concurrent.AbstractEventExecutorGroup
io.netty.util.concurrent.MultithreadEventExecutorGroup
io.netty.channel.MultithreadEventLoopGroup
io.netty.channel.MultiThreadIoEventLoopGroup
- All Implemented Interfaces:
EventLoopGroup, IoEventLoopGroup, EventExecutorGroup, Iterable<EventExecutor>, Executor, ExecutorService, ScheduledExecutorService
- Direct Known Subclasses:
EpollEventLoopGroup, KQueueEventLoopGroup, LocalEventLoopGroup, NioEventLoopGroup
public class MultiThreadIoEventLoopGroup
extends MultithreadEventLoopGroup
implements IoEventLoopGroup
IoEventLoopGroup implementation that will handle its tasks with multiple threads.
This group supports advanced thread management strategies, such as dynamic auto-scaling,
by providing a custom EventExecutorChooserFactory. To enable utilization-based
auto-scaling, pass an instance of
AutoScalingEventExecutorChooserFactory.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionMultiThreadIoEventLoopGroup(int nThreads, IoHandlerFactory ioHandlerFactory) /** Creates a new instance of theMultiThreadIoEventLoopGroupusing the defaultThreadFactory.MultiThreadIoEventLoopGroup(int nThreads, Executor executor, IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, Executor executor, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, Executor executor, IoHandlerFactory ioHandlerFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.MultiThreadIoEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroup.MultiThreadIoEventLoopGroup(int nThreads, ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.MultiThreadIoEventLoopGroup(IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroupusing the default number of threads and defaultThreadFactory.MultiThreadIoEventLoopGroup(Executor executor, IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroupusing the default number of threads.MultiThreadIoEventLoopGroup(ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory) Create a new instance using the default number of thread. -
Method Summary
Modifier and TypeMethodDescriptionprotected IoEventLoopnewChild(Executor executor, IoHandlerFactory ioHandlerFactory, Object... args) protected EventLoopCreate a new EventExecutor which will later then accessible via theMultithreadEventExecutorGroup.next()method.next()Returns one of theEventExecutors managed by thisEventExecutorGroup.Methods inherited from class MultithreadEventLoopGroup
newDefaultThreadFactory, register, register, registerMethods inherited from class MultithreadEventExecutorGroup
activeExecutorCount, awaitTermination, executorCount, executorUtilizations, isShutdown, isShuttingDown, isTerminated, iterator, shutdown, shutdownGracefully, terminationFutureMethods inherited from class AbstractEventExecutorGroup
execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EventExecutorGroup
isShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture, tickerMethods inherited from interface EventLoopGroup
registerMethods inherited from interface ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminatedMethods inherited from interface IoEventLoopGroup
isCompatible, isIoType, register, register, registerMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
MultiThreadIoEventLoopGroup
Creates a new instance of theMultiThreadIoEventLoopGroupusing the default number of threads and defaultThreadFactory. -
MultiThreadIoEventLoopGroup
/** Creates a new instance of theMultiThreadIoEventLoopGroupusing the defaultThreadFactory.- Parameters:
nThreads- the number of threads and soEventLoops that are created.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.
-
MultiThreadIoEventLoopGroup
Create a new instance using the default number of thread.- Parameters:
threadFactory- theThreadFactorythat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.
-
MultiThreadIoEventLoopGroup
Creates a new instance of theMultiThreadIoEventLoopGroupusing the default number of threads.- Parameters:
executor- theExecutorthat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(int nThreads, Executor executor, IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroup.- Parameters:
nThreads- the number of threads and soEventLoops that are created.executor- theExecutorthat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(int nThreads, ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroup.- Parameters:
nThreads- the number of threads and soEventLoops that are created.threadFactory- theThreadFactorythat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, IoHandlerFactory ioHandlerFactory) Creates a new instance of theMultiThreadIoEventLoopGroup.- Parameters:
nThreads- the number of threads and soEventLoops that are created.executor- theExecutorthat is used.chooserFactory- theEventExecutorChooserFactorythat is used to choose theIoEventLoopwhennext()is called.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.
-
MultiThreadIoEventLoopGroup
protected MultiThreadIoEventLoopGroup(int nThreads, Executor executor, IoHandlerFactory ioHandlerFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.- Parameters:
nThreads- the number of threads and soEventLoops that are created.executor- theExecutorthat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.args- extra args that are passed tonewChild(Executor, Object...)method.
-
MultiThreadIoEventLoopGroup
protected MultiThreadIoEventLoopGroup(int nThreads, ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.- Parameters:
nThreads- the number of threads and soEventLoops that are created.threadFactory- theThreadFactorythat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.args- extra args that are passed tonewChild(Executor, Object...)method.
-
MultiThreadIoEventLoopGroup
protected MultiThreadIoEventLoopGroup(int nThreads, ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.- Parameters:
nThreads- the number of threads and soEventLoops that are created.threadFactory- theThreadFactorythat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.chooserFactory- theEventExecutorChooserFactorythat is used to choose theargs- extra args that are passed tonewChild(Executor, Object...)method.
-
MultiThreadIoEventLoopGroup
protected MultiThreadIoEventLoopGroup(int nThreads, Executor executor, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, Object... args) Creates a new instance of theMultiThreadIoEventLoopGroup.- Parameters:
nThreads- the number of threads and soEventLoops that are created.executor- theExecutorthat is used.ioHandlerFactory- theIoHandlerFactorythat will be used to createIoHandlerfor handling IO.chooserFactory- theEventExecutorChooserFactorythat is used to choose theargs- extra args that are passed tonewChild(Executor, Object...)method.
-
-
Method Details
-
newChild
Description copied from class:MultithreadEventExecutorGroupCreate a new EventExecutor which will later then accessible via theMultithreadEventExecutorGroup.next()method. This method will be called for each thread that will serve thisMultithreadEventExecutorGroup.- Specified by:
newChildin classMultithreadEventLoopGroup- Throws:
Exception
-
newChild
protected IoEventLoop newChild(Executor executor, IoHandlerFactory ioHandlerFactory, Object... args) - Parameters:
executor- theExecutorthat should be used to handle execution of tasks and IO.ioHandlerFactory- theIoHandlerFactorythat should be used to obtainIoHandlerto handle IO.args- extra arguments that are based by the constructor.- Returns:
- the created
IoEventLoop.
-
next
Description copied from interface:EventExecutorGroupReturns one of theEventExecutors managed by thisEventExecutorGroup.- Specified by:
nextin interfaceEventExecutorGroup- Specified by:
nextin interfaceEventLoopGroup- Specified by:
nextin interfaceIoEventLoopGroup- Overrides:
nextin classMultithreadEventLoopGroup
-