随笔分类 - Netty
摘要:6.1 解码器 6.1.1 抽象类 ByteToMessageDecoder a). 必须实现的抽象方法,调用时传入包含数据的ByteBuf,一个添加解码消息的List, 对这个方法的调用会重复进行 ,直到byteBuf中没有可读取的数据。 b). 如果list不为空,那么内容会 循环 传递给下一个
阅读全文
摘要:| 方法 | 职责 | | |: | | writeInbound(Object... msgs) | 将入站消息写入到EmbeddedChannel中 | | readInbound() | 从EmbeddedChannel中读取一个入站消息,任何返回的消息都穿过了整个ChannelPipeLin
阅读全文
摘要:4.1 Channelhandler 4.1.1 Channel声明周期(状态事件) | 方法 | 描述 | | : : |: | | ChannelUnregistered | Channnel已创建,但是未注册到EventLoop | | ChannelRegistered | Channnel
阅读全文
摘要:a). 容量可按需增长,类似(StringBuilder) b). 读写模式之间不需要flip切换 c). 读和写使用不同的索引 writerIndex/readerIndex d). 支持方法的链式调用 5.1 CompositeBuffer() ByteBuf数组 5.2 生成ByteBuf d
阅读全文
摘要:a). EventLoopGroup为每个新创建的channel分配一个EventLoop,多个channel对应一个EventLoop. b). 一个EventLoop由一个不变的thread驱动,处理channel上所有的IO事件, c). EventLoop往上一直集成自ScheduledEx
阅读全文
摘要:2.1 ChannelOption和属性 //设置属性 bootstrap.option("xxx", 1231231); bootstrap.attr("xxx", 123123); //获取属性值 int idValue = ctx.channel.attr("xxx").get();
阅读全文
摘要:0. 关键点 1.1 Channel 类似socket,管道 1.2 回调 操作完成时调用 1.3 Future 异步通知 更精确的异步 类似更精确的异步。 JDK预置concurrent.Future需要手动检查对应的操作是否已完成,非常繁琐。 Netty封装成ChannelFuture消除手动检
阅读全文

浙公网安备 33010602011771号