Determine trigger for ChannelInboundHandlerAdapter.channelInactive()

96 views
Skip to first unread message

Mark Anderson

unread,
May 14, 2015, 9:43:00 AM5/14/15
to ne...@googlegroups.com
In a Netty client when overriding ChannelInboundHandlerAdapter.channelInactive() is it possible to differentiate between the following two scenarios that could trigger channelInactive() being called:
  1. The connection is closed on the server-side causing a disconnect by peer
  2. The channel was closed by the client calling channel.close()
If not is there any kind of standard usage pattern for Netty that could achieve this?

Thanks,
Mark
 

Norman Maurer

unread,
May 14, 2015, 11:06:58 AM5/14/15
to ne...@googlegroups.com
The only way would be to extend ChannelDuplexHandler and override close(...) and channelInactive(...) . This way you could detect if you or the remote peer triggered the close.

Bye,
Norman
--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/7cca2bb4-32fe-454a-ae2c-4b323efa1d53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages