On 7/28/07, James Im <[EMAIL PROTECTED]> wrote:
> I'm looking a little bit at the source code today and there is something
> that I don't understand.
>
> In the class SocketAcceptor.Worker, in the catch block there is a
> "Thread.sleep(1000);". I don't understand why you do that. What problem
> does this solve? Could you add a comment in the source that tells why
> this sleep is needed? That would be the best place to document this as
> its purpose is not obvious. Should I create a jira issue for that?
>
> } catch (IOException e) {
>    ExceptionMonitor.getInstance().exceptionCaught(e);
>
>    try {
>        Thread.sleep(1000);
>    } catch (InterruptedException e1) {
>        ExceptionMonitor.getInstance().exceptionCaught(e1);
>    }
> }

The sleep here is inserted for the case that an IOException is kept
thrown when a network card goes down.  Once the network card is
disabled by 'ifdown', Selector can throw an IOException infinitely
until it's enabled again.  I added sleep(1000); to avoid excessive
exception logging.

Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to