源码中都加注释啦
/*
*/
package org.apache.mina.filter.executor;
import java.util.EnumSet;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import org.apache.mina.core.filterchain.IoFilterAdapter;
import org.apache.mina.core.filterchain.IoFilterChain;
import org.apache.mina.core.filterchain.IoFilterEvent;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoEventType;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.core.write.WriteRequest;
/**
* A filter that forwards转发 I/O events to {@link Executor} to enforce执行 a certain
* thread model while allowing the events per session to be processed
* simultaneously同时地处理. You can apply various thread model by inserting this filter
* to a {@link IoFilterChain}.
*
* <h2>Life Cycle Management</h2>
* 这个过滤器ExecutorFilter不负责Executor的生命周期管理
* Please note that this filter doesn't manage the life cycle of the {@link Executor}.
* 如果你用ExecutorFilter(Executor)或相似的构造函数创建了一个过滤器,则你自己要负责管理Executor
* 实例的生命周期,比如调用ExecutorService#shutdown()函数关闭线程池
* If you created this filter using {@link #ExecutorFilter(Executor)} or similar
* constructor that accepts an {@link Executor} that you've instantiated实例化, you have
* full control and responsibility of managing its life cycle (e.g. calling
* {@link ExecutorService#shutdown()}.
* <p>
* If you created this filter using convenience constructors like
* {@link #ExecutorFilter(int)}, then you can shut down the executor by calling
* {@link #destroy()} explicitly.
*
* <h2>Event Ordering</h2>
*
* All convenience constructors of this filter creates a new
* {@link OrderedThreadPoolExecutor} instance. Therefore, the order of event is
* maintained like the following:
* <ul>
* <li>All event handler methods are called exclusively唯一地.
* 所有的事件处理函数在同一时刻只有一个被调用,并且是按顺序调用
* (e.g. messageReceived and messageSent can't be invoked at the same time.)</li>
* <li>The event order is never mixed up.
* (e.g. messageReceived is always invoked before sessionClosed or messageSent.)</li>
* </ul>
* However, if you specified other {@link Executor} instance in the constructor,