public class ThreadPerChannelEventLoopGroup extends AbstractEventExecutorGroup implements EventLoopGroup
EventLoopGroup创建一个EventLoop每Channel 。
| Modifier | Constructor and Description |
|---|---|
protected |
ThreadPerChannelEventLoopGroup()
创建一个没有限制的新的 ThreadPerChannelEventLoopGroup 。
|
protected |
ThreadPerChannelEventLoopGroup(int maxChannels)
创建一个新的 ThreadPerChannelEventLoopGroup 。
|
protected |
ThreadPerChannelEventLoopGroup(int maxChannels, java.util.concurrent.Executor executor, java.lang.Object... args)
创建一个新的 ThreadPerChannelEventLoopGroup 。
|
protected |
ThreadPerChannelEventLoopGroup(int maxChannels, java.util.concurrent.ThreadFactory threadFactory, java.lang.Object... args)
创建一个新的 ThreadPerChannelEventLoopGroup 。
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isShuttingDown()
当且仅当由此 EventExecutorGroup管理的所有EventExecutor都是shut down gracefully或被关闭时才返回true 。
|
boolean |
isTerminated() |
java.util.Iterator<EventExecutor> |
iterator() |
protected EventLoop |
newChild(java.lang.Object... args)
创建一个新的 EventLoop 。
|
EventLoop |
next()
返回下一个 EventLoop以供使用
|
ChannelFuture |
register(Channel channel)
|
ChannelFuture |
register(Channel channel, ChannelPromise promise)
已过时。
|
ChannelFuture |
register(ChannelPromise promise)
使用 ChannelFuture通过此EventLoop注册一个Channel 。
|
void |
shutdown()
已过时。
|
Future<?> |
shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
该执行者表示该调用者希望执行者被关闭。
|
Future<?> |
terminationFuture()
返回 Future ,当由此EventExecutorGroup管理的所有EventExecutor均已终止时,将通知该Future 。
|
execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitschedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submitprotected ThreadPerChannelEventLoopGroup()
ThreadPerChannelEventLoopGroup 。
protected ThreadPerChannelEventLoopGroup(int maxChannels)
ThreadPerChannelEventLoopGroup 。
maxChannels - 此实例处理的最大通道数。
一旦你尝试注册一个新的Channel ,最大值超过它将会抛出一个ChannelException 。
在register(Channel)和register(ChannelPromise)方法上。
使用0不限制
protected ThreadPerChannelEventLoopGroup(int maxChannels,
java.util.concurrent.ThreadFactory threadFactory,
java.lang.Object... args)
ThreadPerChannelEventLoopGroup 。
maxChannels - 此实例处理的最大通道数。
一旦你尝试注册一个新Channel ,最高为超过它会抛出一个ChannelException对register(Channel)和register(ChannelPromise)方法。
使用0不限制
threadFactory - ThreadFactory用于创建处理注册的Channel的新的Thread实例
args - 将传递给每个
newChild(Object...)调用的参数。
protected ThreadPerChannelEventLoopGroup(int maxChannels,
java.util.concurrent.Executor executor,
java.lang.Object... args)
ThreadPerChannelEventLoopGroup 。
maxChannels - 此实例处理的最大通道数。
一旦你尝试注册一个新的Channel ,并且最大值超过,它将在register(Channel)和register(ChannelPromise)方法上抛出一个ChannelException 。
使用0不限制
executor - Executor用于创建处理注册的Channel的新的Thread实例
args - 将传递给每个
newChild(Object...)调用的参数。
protected EventLoop newChild(java.lang.Object... args) throws java.lang.Exception
EventLoop 。
默认实现将创建一个新的ThreadPerChannelEventLoop 。
java.lang.Exception
public java.util.Iterator<EventExecutor> iterator()
iterator在界面
EventExecutorGroup
iterator ,界面
java.lang.Iterable<EventExecutor>
public EventLoop next()
EventLoopGroup
EventLoop以供使用
next在界面
EventLoopGroup
next在界面
EventExecutorGroup
public Future<?> shutdownGracefully(long quietPeriod, long timeout, java.util.concurrent.TimeUnit unit)
EventExecutorGroup复制的描述
EventExecutorGroup.isShuttingDown()开始返回true ,执行程序准备自行关闭。
与EventExecutorGroup.shutdown()不同的是 ,正常关机可确保在关闭之前不会提交“安静期” (通常是几秒钟)的任务。
如果任务在安静期提交,则保证被接受,安静期将重新开始。
shutdownGracefully在界面
EventExecutorGroup
quietPeriod - 文档中描述的安静期
timeout - 无论任务是否在安静期间提交,等待执行程序为
EventExecutorGroup.shutdown()的最长时间
unit -
quietPeriod和
timeout的单位
EventExecutorGroup.terminationFuture()
public Future<?> terminationFuture()
EventExecutorGroup复制的描述
Future ,当由此EventExecutorGroup管理的所有EventExecutor已终止时将通知该Future 。
terminationFuture在界面
EventExecutorGroup
@Deprecated public void shutdown()
shutdown ,界面
EventExecutorGroup
shutdown在界面
java.util.concurrent.ExecutorService
shutdown在课堂上
AbstractEventExecutorGroup
public boolean isShuttingDown()
EventExecutorGroup复制的描述
true当且仅当所有EventExecutor由该被管小号EventExecutorGroup正在shut down gracefully或者被关闭。
isShuttingDown接口
EventExecutorGroup
public boolean isShutdown()
isShutdown在界面
java.util.concurrent.ExecutorService
public boolean isTerminated()
isTerminated在界面
java.util.concurrent.ExecutorService
public boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination ,界面
java.util.concurrent.ExecutorService
java.lang.InterruptedException
public ChannelFuture register(Channel channel)
EventLoopGroup
Channel这个EventLoop 。
一旦注册完成,返回的ChannelFuture将会收到通知。
register ,界面
EventLoopGroup
public ChannelFuture register(ChannelPromise promise)
EventLoopGroup复制的描述
ChannelFuture通过此EventLoop注册Channel 。
一旦注册完成,通过的ChannelFuture将会收到通知,并且会被退回。
register在界面
EventLoopGroup
@Deprecated public ChannelFuture register(Channel channel, ChannelPromise promise)
EventLoopGroup
Channel这个EventLoop 。
一旦注册完成,通过的ChannelFuture将会收到通知,并且会返回。
register在界面
EventLoopGroup
Copyright © 2008–2018 The Netty Project. All rights reserved.