Package io.netty.channel
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,java.lang.Iterable<EventExecutor>,java.util.concurrent.Executor,java.util.concurrent.ExecutorService,java.util.concurrent.ScheduledExecutorService
- Direct Known Subclasses:
EpollEventLoopGroup,KQueueEventLoopGroup,LocalEventLoopGroup,NioEventLoopGroup
public class MultiThreadIoEventLoopGroup extends MultithreadEventLoopGroup implements IoEventLoopGroup
IoEventLoopGroupimplementation 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 ofAutoScalingEventExecutorChooserFactory.
-
-
Constructor Summary
Constructors Modifier Constructor Description MultiThreadIoEventLoopGroup(int nThreads, IoHandlerFactory ioHandlerFactory)/** Creates a new instance of theMultiThreadIoEventLoopGroupusing the defaultThreadFactory.MultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory)Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, java.lang.Object... args)Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, java.lang.Object... args)Creates a new instance of theMultiThreadIoEventLoopGroup.MultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, EventExecutorChooserFactory chooserFactory, IoHandlerFactory ioHandlerFactory)Creates a new instance of theMultiThreadIoEventLoopGroup.MultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory)Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, java.lang.Object... args)Creates a new instance of theMultiThreadIoEventLoopGroup.protectedMultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, java.lang.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(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory)Creates a new instance of theMultiThreadIoEventLoopGroupusing the default number of threads.MultiThreadIoEventLoopGroup(java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory)Create a new instance using the default number of thread.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IoEventLoopnewChild(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, java.lang.Object... args)protected EventLoopnewChild(java.util.concurrent.Executor executor, java.lang.Object... args)Create a new EventExecutor which will later then accessible via theMultithreadEventExecutorGroup.next()method.IoEventLoopnext()Returns one of theEventExecutors managed by thisEventExecutorGroup.-
Methods inherited from class io.netty.channel.MultithreadEventLoopGroup
newDefaultThreadFactory, register, register, register
-
Methods inherited from class io.netty.util.concurrent.MultithreadEventExecutorGroup
activeExecutorCount, awaitTermination, executorCount, executorUtilizations, isShutdown, isShuttingDown, isTerminated, iterator, shutdown, shutdownGracefully, terminationFuture
-
Methods inherited from class io.netty.util.concurrent.AbstractEventExecutorGroup
execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.util.concurrent.EventExecutorGroup
isShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture, ticker
-
Methods inherited from interface io.netty.channel.EventLoopGroup
register
-
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
-
Methods inherited from interface io.netty.channel.IoEventLoopGroup
isCompatible, isIoType, register, register, register
-
-
-
-
Constructor Detail
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(IoHandlerFactory ioHandlerFactory)
Creates a new instance of theMultiThreadIoEventLoopGroupusing the default number of threads and defaultThreadFactory.
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(int nThreads, IoHandlerFactory ioHandlerFactory)/** 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
public MultiThreadIoEventLoopGroup(java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory)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
public MultiThreadIoEventLoopGroup(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory)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, java.util.concurrent.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, java.util.concurrent.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, java.util.concurrent.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, java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, java.lang.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, java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, java.lang.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, java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, java.lang.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, java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, java.lang.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 Detail
-
newChild
protected EventLoop newChild(java.util.concurrent.Executor executor, java.lang.Object... args) throws java.lang.Exception
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:
java.lang.Exception
-
newChild
protected IoEventLoop newChild(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, java.lang.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
public 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
-
-