public class NioEventLoopGroup extends MultithreadEventLoopGroup
构造器和说明 |
---|
NioEventLoopGroup()
Create a new instance using the default number of threads, the default
ThreadFactory and
the SelectorProvider which is returned by SelectorProvider.provider() . |
NioEventLoopGroup(int nThreads)
Create a new instance using the specified number of threads,
ThreadFactory and the
SelectorProvider which is returned by SelectorProvider.provider() . |
NioEventLoopGroup(int nThreads,
java.util.concurrent.Executor executor) |
NioEventLoopGroup(int nThreads,
java.util.concurrent.Executor executor,
EventExecutorChooserFactory chooserFactory,
java.nio.channels.spi.SelectorProvider selectorProvider,
SelectStrategyFactory selectStrategyFactory) |
NioEventLoopGroup(int nThreads,
java.util.concurrent.Executor executor,
EventExecutorChooserFactory chooserFactory,
java.nio.channels.spi.SelectorProvider selectorProvider,
SelectStrategyFactory selectStrategyFactory,
RejectedExecutionHandler rejectedExecutionHandler) |
NioEventLoopGroup(int nThreads,
java.util.concurrent.Executor executor,
EventExecutorChooserFactory chooserFactory,
java.nio.channels.spi.SelectorProvider selectorProvider,
SelectStrategyFactory selectStrategyFactory,
RejectedExecutionHandler rejectedExecutionHandler,
EventLoopTaskQueueFactory taskQueueFactory) |
NioEventLoopGroup(int nThreads,
java.util.concurrent.Executor executor,
EventExecutorChooserFactory chooserFactory,
java.nio.channels.spi.SelectorProvider selectorProvider,
SelectStrategyFactory selectStrategyFactory,
RejectedExecutionHandler rejectedExecutionHandler,
EventLoopTaskQueueFactory taskQueueFactory,
EventLoopTaskQueueFactory tailTaskQueueFactory) |
NioEventLoopGroup(int nThreads,
java.util.concurrent.Executor executor,
java.nio.channels.spi.SelectorProvider selectorProvider) |
NioEventLoopGroup(int nThreads,
java.util.concurrent.Executor executor,
java.nio.channels.spi.SelectorProvider selectorProvider,
SelectStrategyFactory selectStrategyFactory) |
NioEventLoopGroup(int nThreads,
java.util.concurrent.ThreadFactory threadFactory)
Create a new instance using the specified number of threads, the given
ThreadFactory and the
SelectorProvider which is returned by SelectorProvider.provider() . |
NioEventLoopGroup(int nThreads,
java.util.concurrent.ThreadFactory threadFactory,
java.nio.channels.spi.SelectorProvider selectorProvider)
Create a new instance using the specified number of threads, the given
ThreadFactory and the given
SelectorProvider . |
NioEventLoopGroup(int nThreads,
java.util.concurrent.ThreadFactory threadFactory,
java.nio.channels.spi.SelectorProvider selectorProvider,
SelectStrategyFactory selectStrategyFactory) |
NioEventLoopGroup(java.util.concurrent.ThreadFactory threadFactory)
Create a new instance using the default number of threads, the given
ThreadFactory and the
SelectorProvider which is returned by SelectorProvider.provider() . |
限定符和类型 | 方法和说明 |
---|---|
protected EventLoop |
newChild(java.util.concurrent.Executor executor,
java.lang.Object... args)
Create a new EventExecutor which will later then accessible via the
MultithreadEventExecutorGroup.next() method. |
void |
rebuildSelectors()
Replaces the current
Selector s of the child event loops with newly created Selector s to work
around the infamous epoll 100% CPU bug. |
void |
setIoRatio(int ioRatio)
Sets the percentage of the desired amount of time spent for I/O in the child event loops.
|
newDefaultThreadFactory, next, register, register, register
awaitTermination, executorCount, isShutdown, isShuttingDown, isTerminated, iterator, shutdown, shutdownGracefully, terminationFuture
execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture
public NioEventLoopGroup()
ThreadFactory
and
the SelectorProvider
which is returned by SelectorProvider.provider()
.public NioEventLoopGroup(int nThreads)
ThreadFactory
and the
SelectorProvider
which is returned by SelectorProvider.provider()
.public NioEventLoopGroup(java.util.concurrent.ThreadFactory threadFactory)
ThreadFactory
and the
SelectorProvider
which is returned by SelectorProvider.provider()
.public NioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory)
ThreadFactory
and the
SelectorProvider
which is returned by SelectorProvider.provider()
.public NioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor)
public NioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider)
ThreadFactory
and the given
SelectorProvider
.public NioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory)
public NioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider)
public NioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory)
public NioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory)
public NioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory, RejectedExecutionHandler rejectedExecutionHandler)
public NioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory, RejectedExecutionHandler rejectedExecutionHandler, EventLoopTaskQueueFactory taskQueueFactory)
public NioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory, RejectedExecutionHandler rejectedExecutionHandler, EventLoopTaskQueueFactory taskQueueFactory, EventLoopTaskQueueFactory tailTaskQueueFactory)
nThreads
- the number of threads that will be used by this instance.executor
- the Executor to use, or null
if default one should be used.chooserFactory
- the EventExecutorChooserFactory
to use.selectorProvider
- the SelectorProvider
to use.selectStrategyFactory
- the SelectStrategyFactory
to use.rejectedExecutionHandler
- the RejectedExecutionHandler
to use.taskQueueFactory
- the EventLoopTaskQueueFactory
to use for
SingleThreadEventExecutor.execute(Runnable)
,
or null
if default one should be used.tailTaskQueueFactory
- the EventLoopTaskQueueFactory
to use for
SingleThreadEventLoop.executeAfterEventLoopIteration(Runnable)
,
or null
if default one should be used.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 rebuildSelectors()
Selector
s of the child event loops with newly created Selector
s to work
around the infamous epoll 100% CPU bug.protected EventLoop newChild(java.util.concurrent.Executor executor, java.lang.Object... args) throws java.lang.Exception
MultithreadEventExecutorGroup
MultithreadEventExecutorGroup.next()
method. This method will be
called for each thread that will serve this MultithreadEventExecutorGroup
.newChild
在类中 MultithreadEventLoopGroup
java.lang.Exception