Netty中的EventExecutorGroup

package io.netty.util.concurrent;

import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

/**
 * The {@link EventExecutorGroup} is responsible for providing the
 * {@link EventExecutor}'s to use via its {@link #next()} method. Besides this,
 * it is also responsible for handling their life-cycle and allows shutting them
 * down in a global fashion.
 * EventExecutorGroup负责调用他的next()方法来提供EventExecutor,除了这个之外,他还负责处理他们的生命周期,
 * 并且提供了一个全局的方式来关闭他们。
 *
 */
public interface EventExecutorGroup extends ScheduledExecutorService, Iterable<EventExecutor> {
	/**
	 * * Returns {@code true} if and only if all {@link EventExecutor}s managed by
	 * this {@link EventExecutorGroup} * are being {@linkplain #shutdownGracefully()
	 * shut down gracefully} or was {@linkplain #isShutdown() shut down}.
	 * 当且且当这个EventExecutorGroup所管理的全部EventExecutor正在被优雅的关闭或者关闭之后才会返回true.
	 */
	boolean isShuttingDown();

	/**
	 * Shortcut method for {@link #shutdownGracefully(long, long, TimeUnit)} with
	 * sensible default values. *z * @return the {@link #terminationFuture()}
	 * 这是对另一个全参数方法的缩写,会提供一些默认的值。
	 */
	Future<?> shutdownGracefully();

	/**
	 * Signals this executor that the caller wants the executor to be shut down.
	 * Once this method is called, {@link #isShuttingDown()} starts to return
	 * {@code true}, and the executor prepares to shut itself down. Unlike
	 * {@link #shutdown()}, graceful shutdown ensures that no tasks are submitted
	 * for <i>'the quiet period'</i> (usually a couple seconds) before it shuts
	 * itself down. If a task is submitted during the quiet period, it is guaranteed
	 * to be accepted and the quiet period will start over.
	 * 调用者想让这个执行者关闭,就会通过这个方法告诉执行者。一旦这个方法被调用,isShuttingDown()就会返回true,执行者准备关闭他们自身。
	 * 不像shutdown()方法,优雅的shutdown保证了在它关闭他自身之前的一段的时间内没有任务会被提交,通常这个时间段就是几秒。
	 * 如果一个任务在这个时间内被提交到excutor当中,他就一定会被接受,并且这个时间会被重新开始计算。
	 * 
	 * @param quietPeriod
	 * the quiet period as described in the documentation 
	 * @param timeout the maximum amount of time to wait until the executor is{@linkplain #shutdown()} 
	 * regardless if a task was submitted during the quiet period
	 * @param unit the unit of {@code quietPeriod} and {@code timeout} 
	 * @return the {@link #terminationFuture()}
	 */
	Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit);

	/**
	 * Returns the {@link Future} which is notified when all
	 * {@link EventExecutor}s managed by this * {@link EventExecutorGroup} have been
	 * terminated.
	 */
	Future<?> terminationFuture();

	/**
	 *  Returns one of the {@link EventExecutor}s managed by this {@link EventExecutorGroup}.
                  返回EventExecutorGroup所管理的EventExecutor
     */ 
    EventExecutor next();
    .....
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
       在Java界,Netty无疑是开发网络应用的拿手菜。你不需要太多关注复杂的NIO模型和底层网络的细节,使用其丰富的接口,可以很容易的实现复杂的通讯功能。 本课程准备的十二个实例,按照由简单到复杂的学习路线,让你能够快速学习如何利用Netty来开发网络通信应用。                每个实例简洁、清爽、实用,重点在“用”上,即培训大家如何熟练的使用Netty解决实际问题,抛弃以往边讲应用边分析源码的培训模式所带来的“高不成低不就”情况,在已经能够熟练使用、并且清楚开发流程的基础上再去分析源码就会思路清晰、事半功倍。        本套课程的十二个实例,各自独立,同时又层层递进,每个实例都是针对典型的实际应用场景,学了马上就能应用到实际项目去。 学习好Netty 总有一个理由给你惊喜!! 一、应用场景        Netty已经众多领域得到大规模应用,这些领域包括:物联网领域、互联网领域、电信领域、大数据领域、游戏行业、企业应用、银行证券金融领域、。。。  二、技术深度        多款开源框架应用了Netty,如阿里分布式服务框架 Dubbo 的 RPC 框架、淘宝的消息间件 R0cketMQ、Hadoop 的高性能通信和序列化组件 Avro 的 RPC 框架、开源集群运算框架 Spark、分布式计算框架 Storm、并发应用和分布式应用 Akka、。。。  三、就业前景         很多大厂在招聘高级/资深Java工程师时要求熟练学习、或熟悉Netty,下面只是简要列出,这个名单可以很长。。。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值