Top Description Constructors Methods
io.netty.channel.nio

public Class NioEventLoopGroup

extends MultithreadEventLoopGroup
Class Inheritance
Imports
io.netty.channel.Channel, .DefaultSelectStrategyFactory, .EventLoop, .EventLoopTaskQueueFactory, .MultithreadEventLoopGroup, .SelectStrategyFactory, .SingleThreadEventLoop, io.netty.util.concurrent.EventExecutor, .EventExecutorChooserFactory, .RejectedExecutionHandler, .RejectedExecutionHandlers, java.nio.channels.Selector, java.nio.channels.spi.SelectorProvider, java.util.concurrent.Executor, .ThreadFactory

MultithreadEventLoopGroup implementations which is used for NIO Selector based Channels.

Constructor Summary

AccessConstructor and Description
public
NioEventLoopGroup()

Create a new instance using the default number of threads, the default ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

public
NioEventLoopGroup(int nThreads)

Create a new instance using the specified number of threads, ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

public
NioEventLoopGroup(ThreadFactory threadFactory)

Create a new instance using the default number of threads, the given ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

public
NioEventLoopGroup(int nThreads, ThreadFactory threadFactory)

Create a new instance using the specified number of threads, the given ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

public
NioEventLoopGroup(int nThreads, Executor executor)

public
NioEventLoopGroup(int nThreads, ThreadFactory threadFactory, final SelectorProvider selectorProvider)

Create a new instance using the specified number of threads, the given ThreadFactory and the given SelectorProvider.

public
NioEventLoopGroup(int nThreads, ThreadFactory threadFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory)

public
NioEventLoopGroup(int nThreads, Executor executor, final SelectorProvider selectorProvider)

public
NioEventLoopGroup(int nThreads, Executor executor, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory)

public
NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory)

public
NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory, final RejectedExecutionHandler rejectedExecutionHandler)

public
NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory, final RejectedExecutionHandler rejectedExecutionHandler, final EventLoopTaskQueueFactory taskQueueFactory)

public
NioEventLoopGroup(int
the number of threads that will be used by this instance.
nThreads
,
Executor
the Executor to use, or null if default one should be used.
executor
,
EventExecutorChooserFactory chooserFactory, SelectorProvider
the SelectorProvider to use.
selectorProvider
,
SelectStrategyFactory selectStrategyFactory, RejectedExecutionHandler rejectedExecutionHandler, EventLoopTaskQueueFactory
the EventLoopTaskQueueFactory to use for SingleThreadEventLoop#execute(Runnable), or null if default one should be used.
taskQueueFactory
,
EventLoopTaskQueueFactory tailTaskQueueFactory)

Method Summary

Modifier and TypeMethod and Description
protected EventLoop
newChild(Executor executor, Object... args)

Implements abstract io.netty.channel.MultithreadEventLoopGroup.newChild.

Create a new EventExecutor which will later then accessible via the next() method.
public void
rebuildSelectors()

Replaces the current Selectors of the child event loops with newly created Selectors to work around the infamous epoll 100% CPU bug.

public void
setIoRatio(int ioRatio)

Sets the percentage of the desired amount of time spent for I/O in the child event loops.

Inherited from io.netty.channel.MultithreadEventLoopGroup:
newDefaultThreadFactorynextregisterregisterregister

Constructor Detail

NioEventLoopGroupback to summary
public NioEventLoopGroup()

Create a new instance using the default number of threads, the default ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads)

Create a new instance using the specified number of threads, ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

NioEventLoopGroupback to summary
public NioEventLoopGroup(ThreadFactory threadFactory)

Create a new instance using the default number of threads, the given ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, ThreadFactory threadFactory)

Create a new instance using the specified number of threads, the given ThreadFactory and the SelectorProvider which is returned by SelectorProvider#provider().

NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, Executor executor)
NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, ThreadFactory threadFactory, final SelectorProvider selectorProvider)

Create a new instance using the specified number of threads, the given ThreadFactory and the given SelectorProvider.

NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, ThreadFactory threadFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory)
NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, Executor executor, final SelectorProvider selectorProvider)
NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, Executor executor, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory)
NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory)
NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory, final RejectedExecutionHandler rejectedExecutionHandler)
NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory, final RejectedExecutionHandler rejectedExecutionHandler, final EventLoopTaskQueueFactory taskQueueFactory)
NioEventLoopGroupback to summary
public NioEventLoopGroup(int nThreads, Executor executor, EventExecutorChooserFactory chooserFactory, SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory, RejectedExecutionHandler rejectedExecutionHandler, EventLoopTaskQueueFactory taskQueueFactory, EventLoopTaskQueueFactory tailTaskQueueFactory)
Parameters
nThreads:int

the number of threads that will be used by this instance.

executor:Executor

the Executor to use, or null if default one should be used.

chooserFactory:EventExecutorChooserFactory

the EventExecutorChooserFactory to use.

selectorProvider:SelectorProvider

the SelectorProvider to use.

selectStrategyFactory:SelectStrategyFactory

the SelectStrategyFactory to use.

rejectedExecutionHandler:RejectedExecutionHandler

the RejectedExecutionHandler to use.

taskQueueFactory:EventLoopTaskQueueFactory

the EventLoopTaskQueueFactory to use for SingleThreadEventLoop#execute(Runnable), or null if default one should be used.

tailTaskQueueFactory:EventLoopTaskQueueFactory

the EventLoopTaskQueueFactory to use for SingleThreadEventLoop#executeAfterEventLoopIteration(Runnable), or null if default one should be used.

Method Detail

newChildback to summary
protected EventLoop newChild(Executor executor, Object... args) throws Exception

Implements abstract io.netty.channel.MultithreadEventLoopGroup.newChild.

Doc from io.netty.util.concurrent.MultithreadEventExecutorGroup.newChild.

Create a new EventExecutor which will later then accessible via the next() method. This method will be called for each thread that will serve this MultithreadEventExecutorGroup.

Annotations
@Override
rebuildSelectorsback to summary
public void rebuildSelectors()

Replaces the current Selectors of the child event loops with newly created Selectors to work around the infamous epoll 100% CPU bug.

setIoRatioback to summary
public void setIoRatio(int ioRatio)

Sets the percentage of the desired amount of time spent for I/O in the child event loops. The default value is 50, which means the event loop will try to spend the same amount of time for I/O as for non-I/O tasks.