Netty in Action

本书浅显易懂地介绍了Netty的设计理念与实践,详细解释了ChannelHandlerAdapter、ChannelPipeline和ChannelHandlerContext等核心组件的工作原理,包括它们在事件传播过程中的相对位置与作用,以及如何通过设置Java系统属性调整内存泄漏检测级别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

总的来说这本书讲的比较浅显,但是对于理解Netty的设计思路很有帮助,里面提到的最佳实践现在已经算是普通实践了
以下是一些读书摘要
ChannelHandlerAdapter also provides the utility method isShareable(). This method returns true if the implementation is annotated as shareable Indicating that it can be added to multiple channelpipelines.

The leak detection level is defined by setting the following Java system property to one of the values in the table :disabled, simple advanced paranoid.
java -Dio.netty.leakDetectLevel=SIMPLE

ChannelPipeline relativity
When you’ve finished adding your mixed of inbound and outbound handlers to a channel pipeline using the channel pipeline.add* method, the ordinal of each channel handler is its position from beginning to end as we just defined them. Thus if you number, the handlers in fingers 6.3 from left to right. The first channel handler seen by a inbound event will be one. The first hand and seen by a outbound event will be fine.
在这里插入图片描述
Interface channelHandlerContext.
ChannelHandlerContext has numerous methods, some of which are also present on channel and on channel pipeline itself. But there is an important difference. If you invoke these methods on a channel or channel pipeline instance, they propagate through the entire pipeline, the same methods called on a channel Handler context will start at the current associated channel Handler and propagate only to the next channel handler in the pipeline that is capable of handing the event.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值