1.EventLoop的类关系图
2. EventExecutor
/*** 返回自身的对象* Returns a reference to itself.*/@OverrideEventExecutor next();/*** 获取所属的EventExecutorGroup* Return the {@link EventExecutorGroup} which is the parent of this {@link EventExecutor},*/EventExecutorGroup parent();/*** 当前线程是否在 EventLoop 线程中* Calls {@link #inEventLoop(Thread)} with {@link Thread#currentThread()} as argument*/boolean inEventLoop();/*** 指定线程是否是 EventLoop 线程* Return {@code true} if the given {@link Thread} is executed in the event loop,* {@code false} otherwise.*/boolean inEventLoop(Thread thread);/*** 创建一个 Promise 对象* Return a new {@link Promise}.*/<V> Promise<V> newPromise();/*** 创建一个 ProgressivePromise 对象* Create a new {@link ProgressivePromise}.*/<V> ProgressivePromise<V> newProgressivePromise();/*** 创建成功结果的 Future 对象* Create a new {@link Future} which is marked as succeeded already. So {@link Future#isSuccess()}* will return {@code true}. All {@link FutureListener} added to it will be notified directly. Also* every call of blocking methods will just return without blocking.*/<V> Future<V> newSucceededFuture(V result);/*** 创建异常的 Future 对象* Create a new {@link Future} which is marked as failed already. So {@link Future#isSuccess()}* will return {@code false}. All {@link FutureListener} added to it will be notified directly. Also* every call of blocking methods will just return without blocking.*/<V> Future<V> newFailedFuture(Throwable cause);
3.OrderedEventExecutor
public interface OrderedEventExecutor extends EventExecutor {
}
4. EventLoop
public interface EventLoop extends OrderedEventExecutor, EventLoopGroup {@OverrideEventLoopGroup parent();
}
5.AbstractEventExecutor
5.1构造函数
protected AbstractEventExecutor() {this(null);}protected AbstractEventExecutor(EventExecutorGroup parent) {this.parent = parent;}