How to make exceptions (like channel closed exceptions) reach the sending code.

"Trustin Lee (이희승)" trustin at gmail.com
Mon Mar 8 04:42:53 EST 2010


Hi David,

David Alves wrote:
> Hi again
> 
> Sorry for the great amount of messages to the list lately :)
> I have to handlers that handle channel closed exceptions but these never
> reach my application code, which means the logs are spammed with senders
> trying to write to an already closed channel. Both handlers override the
> handleUpStream() and exceptionCaught() methods of SimpleChannelHandler
> for logging like this:

</snip>

>     In the application code I catch any exception to prevent sending to
> closed channels but these catch statements are never used. What am I
> missing?

You will never get the exception event in your application handler since
you did not fire exceptionCaught event in your exceptionCaught() handler
method.  If you want it to be forwarded to the next handler, you have to
send the event to the next handler by calling ctx.sendUpstream(evt).
Instead, your logging handler triggered channelClosed event.

HTH,
Trustin

-- 
what we call human nature in actuality is human habit
http://gleamynode.net/


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100308/7a7a09a8/attachment.bin 


More information about the netty-users mailing list