0、一些代码内容ServerBootstrap(group、channel) EventLoopGroup ChannelFuture
1、 reactor模型相关实现:
客户端请求-->reactor线程(eventloopselector做事件轮训-->dispatcher分发) --->处理方法
netty启动时会构建多个EventloopGroup(reactor线程)
2、pipeline 责任链相关
责任链: 可以认为是责任递进的链条(集合形式、链表形式)。包含:处理器抽象类、处理器实现、保存处理器信息(下个节点)、处理执行
registered入栈时间处理:bind端口abstractBootStrap--》创建和初始化channel--》注册eventLoop到selector上(config group register后 触发channel注册) ps 初始化handler仅执行一次
注册完成后 省下 headcontext loggingHandler ServerBootstrapAcceptor tailcontext
bind 出站事件处理 bind(端口):abstractBootstrap ->创建和初始化channel -> 注册到eventloop的selector上 ->channelbind -> pipelinebind
accept入栈事件的处理:Eventloop轮询到accept事件-》nioMessageUnsafe.read
3、bytebuf
容量(可以动态扩容)、读取位置、写入位置----已读取区域,可读取区域、待写区域
实现方式:堆内堆外、是否池化、访问方式(safe,unsafe)