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
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 ofAutoScalingEventExecutorChooserFactory
.
-
-
Constructor Summary
Constructors Modifier Constructor Description MultiThreadIoEventLoopGroup(int nThreads, IoHandlerFactory ioHandlerFactory)
/** Creates a new instance of theMultiThreadIoEventLoopGroup
using the defaultThreadFactory
.MultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory)
Creates a new instance of theMultiThreadIoEventLoopGroup
.protected
MultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, java.lang.Object... args)
Creates a new instance of theMultiThreadIoEventLoopGroup
.protected
MultiThreadIoEventLoopGroup(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
.protected
MultiThreadIoEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory, EventExecutorChooserFactory chooserFactory, java.lang.Object... args)
Creates a new instance of theMultiThreadIoEventLoopGroup
.protected
MultiThreadIoEventLoopGroup(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 theMultiThreadIoEventLoopGroup
using the default number of threads and defaultThreadFactory
.MultiThreadIoEventLoopGroup(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory)
Creates a new instance of theMultiThreadIoEventLoopGroup
using 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 IoEventLoop
newChild(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, java.lang.Object... args)
protected EventLoop
newChild(java.util.concurrent.Executor executor, java.lang.Object... args)
Create a new EventExecutor which will later then accessible via theMultithreadEventExecutorGroup.next()
method.IoEventLoop
next()
Returns one of theEventExecutor
s managed by thisEventExecutorGroup
.-
Methods inherited from class io.netty.channel.MultithreadEventLoopGroup
newDefaultThreadFactory, register, register, register
-
Methods inherited from class io.netty.util.concurrent.MultithreadEventExecutorGroup
awaitTermination, executorCount, 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 theMultiThreadIoEventLoopGroup
using the default number of threads and defaultThreadFactory
.
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(int nThreads, IoHandlerFactory ioHandlerFactory)
/** Creates a new instance of theMultiThreadIoEventLoopGroup
using the defaultThreadFactory
.- Parameters:
nThreads
- the number of threads and soEventLoop
s that are created.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for handling IO.
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(java.util.concurrent.ThreadFactory threadFactory, IoHandlerFactory ioHandlerFactory)
Create a new instance using the default number of thread.- Parameters:
threadFactory
- theThreadFactory
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for handling IO.
-
MultiThreadIoEventLoopGroup
public MultiThreadIoEventLoopGroup(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory)
Creates a new instance of theMultiThreadIoEventLoopGroup
using the default number of threads.- Parameters:
executor
- theExecutor
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for 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 soEventLoop
s that are created.executor
- theExecutor
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for 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 soEventLoop
s that are created.threadFactory
- theThreadFactory
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for 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 soEventLoop
s that are created.executor
- theExecutor
that is used.chooserFactory
- theEventExecutorChooserFactory
that is used to choose theIoEventLoop
whennext()
is called.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for 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 soEventLoop
s that are created.executor
- theExecutor
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for 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 soEventLoop
s that are created.threadFactory
- theThreadFactory
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for 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 soEventLoop
s that are created.threadFactory
- theThreadFactory
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for handling IO.chooserFactory
- theEventExecutorChooserFactory
that 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 soEventLoop
s that are created.executor
- theExecutor
that is used.ioHandlerFactory
- theIoHandlerFactory
that will be used to createIoHandler
for handling IO.chooserFactory
- theEventExecutorChooserFactory
that 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:MultithreadEventExecutorGroup
Create 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:
newChild
in classMultithreadEventLoopGroup
- Throws:
java.lang.Exception
-
newChild
protected IoEventLoop newChild(java.util.concurrent.Executor executor, IoHandlerFactory ioHandlerFactory, java.lang.Object... args)
- Parameters:
executor
- theExecutor
that should be used to handle execution of tasks and IO.ioHandlerFactory
- theIoHandlerFactory
that should be used to obtainIoHandler
to handle IO.args
- extra arguments that are based by the constructor.- Returns:
- the created
IoEventLoop
.
-
next
public IoEventLoop next()
Description copied from interface:EventExecutorGroup
Returns one of theEventExecutor
s managed by thisEventExecutorGroup
.- Specified by:
next
in interfaceEventExecutorGroup
- Specified by:
next
in interfaceEventLoopGroup
- Specified by:
next
in interfaceIoEventLoopGroup
- Overrides:
next
in classMultithreadEventLoopGroup
-
-