EventLoop相当于一个Thread线程,而EventLoopGroup则是管理这些EventLoop的Thread线程池
  EventLoop接口
  package io.netty.channel;
public interface EventLoop extends EventExecutor, EventLoopGroup {
    @Override
    EventLoopGroup parent();
}
  
  EventLoop接口UML图
  parent()方法
  返回管理这个EventLoop的EventLoopGroup。
  
  EventLoopGroup接口
  package io.netty.channel;
public interface EventLoopGroup extends EventExecutorGroup {
    @Override
    EventLoop next();
    ChannelFuture register(Channel channel);
    ChannelFuture register(Channel channel, ChannelFuture future);
}
  
  EventLoopGroup接口UML图
   
  next()
  返回下一个EventLoop
  register(Channel channel)
  指定一个EventLoopGroup来注册某个Channel。
备注:因为笔者开始写Netty源码分析的时候,Netty 4.0还是处于Alpha阶段,之后的API可能还会有改动,笔者将会及时更改。使用开源已经有好几年的时间了,一直没有时间和精力来具体研究某个开源项目的具体实现,这次是第一次写开源项目的源码分析,如果文中有错误的地方,欢迎读者可以留言指出。对于转载的读者,请注明文章的出处。
希望和广大的开发者/开源爱好者进行交流,欢迎大家的留言和讨论。
-----------------------------------------------------
Silence, the way to avoid many problems;
Smile, the way to solve many problems;