About SimpleChannelHandler.channelDisconnected

Clement Mathieu clement.mathieu at activeeon.com
Wed Nov 3 15:37:03 EDT 2010


On Wed, 3 Nov 2010 18:51:59 +0000
Bruno de Carvalho <kindernade at gmail.com> wrote:

> Use a (volatile) flag variable or an AtomicBoolean for that effect.
> If you call close(), set the flag to true.
> 
> This way, when the disconnected event is fired you can handle the
> (expected or non-expected) event accordingly.

When possible I prefer to avoid a such "hack". Using a flag
looks like a workaround to address a design issue, and it makes harder
to write concurrent or re-entrant code. 

Using UpstreamChannelStateEvent VS DownstreamChannelStateEvent as
proposed by tsuna seems to be a better solution. 

Regards. 

Clément MATHIEU



More information about the netty-users mailing list