문제

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