Chan Chen Coding...

Netty 4.0 源码分析(六):EventLoop和EventLoopGroup

EventLoop相当于一个Thread线程,而EventLoopGroup则是管理这些EventLoopThread线程池

EventLoop接口

package io.netty.channel;

public interface EventLoop extends EventExecutor, EventLoopGroup {
    @Override
    EventLoopGroup parent();
}


EventLoop接口UML

parent()方法

返回管理这个EventLoopEventLoopGroup


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;

posted on 2012-11-25 21:49 Chan Chen 阅读(4490) 评论(0)  编辑  收藏 所属分类: Netty


只有注册用户登录后才能发表评论。


网站导航: