简体   繁体   中英

In Netty 4.1, when are the handlers in the pipeline removed after closing the channel on the server?

So, we are in the process of migrating from Netty 3.9 to Netty 4.1 on our production servers. There seems to be a difference in the way the ChannelHandler s are added and removed from the pipeline in both the versions. Specifically, after closing a channel on the server, I am logging the ChannelHandler s present in the pipeline at some point. While in Netty 4.1, the pipeline sometimes shows few or none of the handlers, in Netty 3.9, all the handlers are always present. All this after closing the channel reference. Is this expected? When does Netty (both in 3.9 and 4.1) remove all the handlers in the pipeline after a channel is closed?

In netty 4.x we remove all the handlers after each other from the pipeline when a channel is closed. This way we also execute handlerRemoved(...) which may is needed to release memory etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM