Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top