java.lang.Object
cn.wjybxx.concurrent.AbstractEventLoopGroup
cn.wjybxx.concurrent.DefaultFixedEventLoopGroup
- 所有已实现的接口:
EventLoopGroup,FixedEventLoopGroup,IExecutor,IExecutorService,IScheduledExecutorService,AutoCloseable,Iterable<EventLoop>,Executor,ExecutorService,ScheduledExecutorService
public class DefaultFixedEventLoopGroup
extends AbstractEventLoopGroup
implements FixedEventLoopGroup
- 作者:
- wjybxx date 2023/4/8
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明booleanawaitTermination(long timeout, TimeUnit unit) 等待EventLoopGroup进入终止状态 等同于在EventLoopGroup.terminationFuture()进行阻塞操作。intEventLoop的数量。voidprotected void当所有的子节点都进入终结状态时,该方法将被调用 通常用于执行一些清理工作boolean查询EventLoopGroup是否处于关闭状态。boolean查询EventLoopGroup是否处于正在关闭状态。boolean是否已进入终止状态,一旦进入终止状态,表示生命周期真正结束。iterator()注意;如果包含不定数量的EventLoop,返回的是快照。select()选择一个EventLoop用于接下来的任务调度select(int key) voidshutdown()请求关闭 ExecutorService,不再接收新的任务。JDK文档: 请求关闭 ExecutorService,尝试取消所有正在执行的任务,停止所有待执行的任务,并不再接收新的任务。IFuture<?> 返回等待线程终止的future。从类继承的方法 cn.wjybxx.concurrent.AbstractEventLoopGroup
execute, execute, execute, execute, invokeAll, invokeAll, invokeAny, invokeAny, newPromise, schedule, schedule, schedule, scheduleAction, scheduleAtFixedRate, scheduleFunc, scheduleWithFixedDelay, submit, submit, submitAction, submitAction, submitAction, submitAction, submitFunc, submitFunc, submitFunc, submitFunc从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 java.util.concurrent.ExecutorService
close从接口继承的方法 cn.wjybxx.concurrent.IExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newPromise, submit, submit, submit, submit, submitAction, submitAction, submitAction, submitAction, submitFunc, submitFunc, submitFunc, submitFunc从接口继承的方法 cn.wjybxx.concurrent.IScheduledExecutorService
newScheduledPromise, schedule, schedule, schedule, scheduleAction, scheduleAtFixedRate, scheduleFunc, scheduleWithFixedDelay
-
构造器详细资料
-
DefaultFixedEventLoopGroup
-
-
方法详细资料
-
terminationFuture
从接口复制的说明:EventLoopGroup- 指定者:
terminationFuture在接口中EventLoopGroup- 指定者:
terminationFuture在接口中IExecutorService
-
isShuttingDown
public boolean isShuttingDown()从接口复制的说明:EventLoopGroup查询EventLoopGroup是否处于正在关闭状态。 正在关闭状态下,拒绝接收新任务,当执行完所有任务后,进入关闭状态。- 指定者:
isShuttingDown在接口中EventLoopGroup- 指定者:
isShuttingDown在接口中IExecutorService- 返回:
- 如果该
EventLoopGroup管理的所有EventLoop正在关闭或已关闭则返回true
-
isShutdown
public boolean isShutdown()从接口复制的说明:EventLoopGroup查询EventLoopGroup是否处于关闭状态。 关闭状态下,拒绝接收新任务,执行退出前的清理操作,执行完清理操作后,进入终止状态。- 指定者:
isShutdown在接口中EventLoopGroup- 指定者:
isShutdown在接口中ExecutorService- 指定者:
isShutdown在接口中IExecutorService- 返回:
- 如果已关闭,则返回true
-
isTerminated
public boolean isTerminated()从接口复制的说明:EventLoopGroup是否已进入终止状态,一旦进入终止状态,表示生命周期真正结束。- 指定者:
isTerminated在接口中EventLoopGroup- 指定者:
isTerminated在接口中ExecutorService- 指定者:
isTerminated在接口中IExecutorService- 返回:
- 如果已处于终止状态,则返回true
-
awaitTermination
从接口复制的说明:EventLoopGroup等待EventLoopGroup进入终止状态 等同于在EventLoopGroup.terminationFuture()进行阻塞操作。- 指定者:
awaitTermination在接口中EventLoopGroup- 指定者:
awaitTermination在接口中ExecutorService- 指定者:
awaitTermination在接口中IExecutorService- 参数:
timeout- 时间度量unit- 事件单位- 返回:
- 在方法返回前是否已进入终止状态
- 抛出:
InterruptedException- 如果在等待期间线程被中断,则抛出该异常。
-
shutdown
public void shutdown()从接口复制的说明:EventLoopGroup请求关闭 ExecutorService,不再接收新的任务。 ExecutorService在执行完现有任务后,进入关闭状态。 如果 ExecutorService 正在关闭,或已经关闭,则方法不产生任何效果。该方法会立即返回,如果想等待 ExecutorService 进入终止状态, 可以使用
EventLoopGroup.awaitTermination(long, TimeUnit)或EventLoopGroup.terminationFuture()进行等待- 指定者:
shutdown在接口中EventLoopGroup- 指定者:
shutdown在接口中ExecutorService- 指定者:
shutdown在接口中IExecutorService
-
shutdownNow
从接口复制的说明:EventLoopGroupJDK文档: 请求关闭 ExecutorService,尝试取消所有正在执行的任务,停止所有待执行的任务,并不再接收新的任务。 如果 ExecutorService 已经关闭,则方法不产生任何效果。该方法会立即返回,如果想等待 ExecutorService 进入终止状态,可以使用
IExecutorService.awaitTermination(long, TimeUnit)或IExecutorService.terminationFuture()进行等待。在EventLoop架构下不保证标准的实现,只保证尽快的关闭。基于以下原因:
- 1. 可能无法安全的获取所有的任务(EventLoop架构属于多生产者单消费者模型,会尽量的避免其它线程消费数据)
- 2. 剩余任务数可能过多
- 指定者:
shutdownNow在接口中EventLoopGroup- 指定者:
shutdownNow在接口中ExecutorService- 指定者:
shutdownNow在接口中IExecutorService- 返回:
- may be empty。
-
invokeTerminationHook
protected void invokeTerminationHook()当所有的子节点都进入终结状态时,该方法将被调用 通常用于执行一些清理工作 -
childCount
public int childCount()从接口复制的说明:FixedEventLoopGroupEventLoop的数量。- 指定者:
childCount在接口中FixedEventLoopGroup
-
select
从接口复制的说明:EventLoopGroup选择一个EventLoop用于接下来的任务调度- 指定者:
select在接口中EventLoopGroup
-
select
从接口复制的说明:FixedEventLoopGroup通过一个键选择一个EventLoop这提供了第二种绑定线程的方式,第一种方式是通过EventLoopGroup.select()分配一个线程,让业务对象持有EventLoop的引用。 现在,你可以为用户分配一个键,通过键建立虚拟绑定。- 指定者:
select在接口中FixedEventLoopGroup- 参数:
key- 计算索引的键;限定int可保证选择性能
-
iterator
从接口复制的说明:EventLoopGroup注意;如果包含不定数量的EventLoop,返回的是快照。- 指定者:
iterator在接口中EventLoopGroup- 指定者:
iterator在接口中Iterable<EventLoop>
-
forEach
-
spliterator
- 指定者:
spliterator在接口中Iterable<EventLoop>
-