I looked at some of the source code in Netty 4.0 and I noticed that AbstractChannel's localAddress and remoteAddress are volatile, and not final.

Are these addresses guaranteed to be set and available when channelActive is triggered?

And, more importantly, what do localAddress() and remoteAddress() return when/after channelInactive is triggered? Do channels keep the addresses, even after the connection is closed?

I'm working with the NIO channels, and mostly on Windows, if it makes any difference.

有帮助吗?

解决方案

These are set lazy, which means basically the first time you try to access them.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top