netty 启动分析 NioEventLoopGroup
来源:互联网 发布:量化炒股软件 编辑:程序博客网 时间:2024/06/10 15:14
ServerBootstrap.bind()方法会实例化一个channel,这个channel的类型是通过channel方法指定的,例如ServerBootstrap.channel(NioServerSocketChannel.class)
指定的同时会创建一个ChannelFactory工厂,默认是ReflectiveChannelFactory,然后bind()方法通过这个ChannelFactory实例化NioServerSocketChannel。
实例化之后会初始化 init方法,获取channel的pipeline,添加handler处理器,
p.addLast(new ChannelInitializer<Channel>() { @Override public void initChannel(Channel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); ChannelHandler handler = handler(); if (handler != null) { pipeline.addLast(handler); } pipeline.addLast(new ServerBootstrapAcceptor( currentChildGroup, currentChildHandler, currentChildOptions, currentChildAttrs)); }});然后使用bossGroup注册,bossGroup是我们创建的NioEventLoopGroup,它维护了一组NioEventLoop,每个维护了一个selector选择器,NioEventLoopGroup。
选择一个NioEventLoop来把channel注册到这个NioEventLoop的选择器上。
0 0
- netty 启动分析 NioEventLoopGroup
- Netty源码分析:NioEventLoopGroup
- Netty源码学习——EventLoopGroup原理:NioEventLoopGroup分析
- Netty源码分析系列1——NIOEventLoopGroup的创建
- 【Netty4.X】Netty源码分析之NioEventLoopGroup(五)
- netty源码分析之-NioEventLoopGroup与线程设定(1)
- netty NioEventLoopGroup 线程名称设置
- Netty笔记一: NioEventLoopGroup介绍
- Netty学习之旅------再谈线程模型之源码分析NioEventLoopGroup、SingleThreadEventExecutor
- Netty启动分析
- Netty启动过程分析
- NioEventLoopGroup
- netty源码分析(一)-启动
- Netty之Reactor线程1 -- NioEventLoopGroup(Reactor线程)
- netty实战之百万级流量NioEventLoopGroup线程数配置
- Netty系列-服务器端启动源码分析
- Netty系列-客户端启动源码分析
- Netty源码分析1 -- 服务器启动
- linux 命令学习网站
- IOS UITableViewCell常用几种动画效果
- 【独家】加入时间特征的船舶轨迹离线压缩算法——经典Douglas-Peucker算法
- java中读取配置文件的方法
- 排序算法之堆排序
- netty 启动分析 NioEventLoopGroup
- php代码优化53个细节
- SLAM中的marginalization 和 Schur complement
- Python中的模块
- C语言里try的用法
- libcurl 库的ftp上传和下载代码
- 简单的二维码扫描
- UGUI字体不清楚——终极探索
- 构建nodejs环境及解决node服务器外网端口无法访问