Netty Server 启动时序图

正常启动netty Server端代码如下

 1 // 配置服务端的NIO线程组
 2     EventLoopGroup bossGroup = new NioEventLoopGroup();
 3     EventLoopGroup workerGroup = new NioEventLoopGroup();
 4     ServerBootstrap b = new ServerBootstrap();
 5     b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
 6         .option(ChannelOption.SO_BACKLOG, 100)
 7         .handler(new LoggingHandler(LogLevel.INFO))
 8         .childHandler(new ChannelInitializer() {
 9             @Override
10             public void initChannel(SocketChannel ch)
11                 throws IOException {
12             ch.pipeline().addLast(
13                 new NettyMessageDecoder(1024 * 1024, 4, 4));
14             ch.pipeline().addLast(new NettyMessageEncoder());
15             ch.pipeline().addLast("readTimeoutHandler",
16                 new ReadTimeoutHandler(50));
17             ch.pipeline().addLast(new LoginAuthRespHandler());
18             ch.pipeline().addLast("HeartBeatHandler",
19                 new HeartBeatRespHandler());
20             }
21         });
22 
23     // 绑定端口,同步等待成功
24     b.bind(NettyConstant.REMOTEIP, NettyConstant.PORT).sync();

时序图如下

Netty Server 启动时序图_第1张图片

转载于:https://www.cnblogs.com/toUpdating/p/10072772.html

你可能感兴趣的:(Netty Server 启动时序图)