You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by James Im <im...@hotmail.com> on 2007/01/12 23:55:37 UTC

What do you do with IoHandler exceptionCaught

I have implemented a IoHandler and its exceptionCaught method.

I'm receiving java.io.IOException error such as "Connection reset by
peer" and "Broken pipe" quite often.

Are yo doing anything with these errors or do you just ignore them?

_________________________________________________________________
Download din yndlingsmusik pĺ MSN Music:  http://www.msn.dk/music  - det er 
nemt og billigt


Re: What do you do with IoHandler exceptionCaught

Posted by Trustin Lee <tr...@gmail.com>.
On 1/13/07, Niklas Therning <ni...@trillian.se> wrote:
>
> James Im wrote:
> > I have implemented a IoHandler and its exceptionCaught method.
> >
> > I'm receiving java.io.IOException error such as "Connection reset by
> > peer" and "Broken pipe" quite often.
> >
> > Are yo doing anything with these errors or do you just ignore them?
> >
> This particular exception you're getting means that the connection has
> been terminated unexpectedly. Just do what you would have done if you
> were using plain old java.net.Socket and it threw the same kind of
> exception: close the session, log the exception (MINA doesn't do that
> for you), release resources, etc.


Strictly speaking, releasing resources should be done in sessionClosed()
method because exceptionCaught is not always called.  You can think of
sessionClosed as a 'finally' block of Java.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6

Re: What do you do with IoHandler exceptionCaught

Posted by Niklas Therning <ni...@trillian.se>.
James Im wrote:
> I have implemented a IoHandler and its exceptionCaught method.
>
> I'm receiving java.io.IOException error such as "Connection reset by
> peer" and "Broken pipe" quite often.
>
> Are yo doing anything with these errors or do you just ignore them?
>
This particular exception you're getting means that the connection has
been terminated unexpectedly. Just do what you would have done if you
were using plain old java.net.Socket and it threw the same kind of
exception: close the session, log the exception (MINA doesn't do that
for you), release resources, etc.

HTH

-- 
Niklas Therning
www.spamdrain.net