public class NioEventLoopGroup extends MultithreadEventLoopGroup
MultithreadEventLoopGroup
用于基于Channel
的NIO Selector
的实现 。
Constructor and Description |
---|
NioEventLoopGroup()
使用默认的线程数创建一个新实例,默认
ThreadFactory 和由
SelectorProvider 返回的
SelectorProvider.provider() 。
|
NioEventLoopGroup(int nThreads)
使用指定数量的线程
ThreadFactory 和由
SelectorProvider 返回的
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, 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)
使用指定的线程数创建一个新实例,给定的
ThreadFactory 和由
SelectorProvider 返回的
SelectorProvider.provider() 。
|
NioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider)
使用指定的线程数创建一个新的实例,给定的
ThreadFactory 和给定的
SelectorProvider 。
|
NioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider, SelectStrategyFactory selectStrategyFactory) |
Modifier and Type | Method and Description |
---|---|
protected EventLoop |
newChild(java.util.concurrent.Executor executor, java.lang.Object... args)
创建一个新的EventExecutor,然后通过
MultithreadEventExecutorGroup.next() 方法访问。
|
void |
rebuildSelectors()
用新创建的
Selector 替换子事件循环的当前
Selector ,以解决臭名昭着的100%CPU bug。
|
void |
setIoRatio(int ioRatio)
设置子事件循环中用于I / O所需时间的百分比。
|
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
和由
SelectorProvider
返回的
SelectorProvider.provider()
。
public NioEventLoopGroup(int nThreads)
ThreadFactory
和由
SelectorProvider
返回的
SelectorProvider.provider()
创建一个新实例。
public NioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory)
ThreadFactory
和由
SelectorProvider
返回的
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
和给定的
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 void setIoRatio(int ioRatio)
50
,这意味着事件循环将尝试花费I / O的时间与非I / O任务的时间相同。
public void rebuildSelectors()
Selector
替换子事件循环的当前
Selector
,以解决臭名昭着的100%CPU bug。
protected EventLoop newChild(java.util.concurrent.Executor executor, java.lang.Object... args) throws java.lang.Exception
MultithreadEventExecutorGroup
MultithreadEventExecutorGroup.next()
方法访问。
这个方法将被调用每个线程,将为此服务MultithreadEventExecutorGroup
。
newChild
在课堂
MultithreadEventLoopGroup
java.lang.Exception
Copyright © 2008–2018 The Netty Project. All rights reserved.