About SimpleChannelHandler.channelDisconnected
Bruno de Carvalho
kindernade at gmail.com
Wed Nov 3 14:51:59 EDT 2010
Clement,
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.
Cheers,
Bruno
On Nov 3, 2010, at 6:27 PM, Clement Mathieu <clement.mathieu at activeeon.com> wrote:
>
> Hi,
>
> How can I distinguish theses two events in a SimpleChannelHandler:
> - The remote peer closed the connection (or connection broken or whatever)
> - My code invoked Channel.close()
>
> Basically I want to perform an action if and only if the connection is
> lost. I don't want to do it if I'm closing the connection from my
> side. I thought that channelDisconnected will do the job, but the
> method is also called when Channel.close() is invoked.
>
>
> Best Regards.
>
> Clément MATHIEU
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
More information about the netty-users
mailing list