Owen O'Malley wrote:
On Aug 25, 2009, at 4:41 PM, Chris K Wensel wrote:
It feels as if it could be wrapped inside a IOException without losing
anything as all the methods I see this on are IO related. And there
doesn't seem to be any special handling for this exception upstream,
but I might be missing it.
No it can't. Arguably it should have been an undeclared exception in
Java. Since it isn't, we have to declare it. It is used for shutting
down threads and wrapping it in an IOException will cause the incorrect
behavior. A common case where that approach fails is where an
IOException causes a retry instead of killing the thread...
-- Owen
I draw your attention to this bit of startup code in JobTracker
try {
Thread.sleep(FS_ACCESS_RETRY_PERIOD);
} catch (InterruptedException e) {
throw new IOException("Interrupted during system directory
cleanup ",
e);
}
A few lines later, an InterruptedException is thrown directly, so the
code isn't being consistent.
-should everything at startup/shutdown time throw InterruptedExceptions
if interrupted? It would make sense, though you have to deal with issues
like Jetty, in its startup sleeps, has code that wraps up its exceptions
too:
} catch (Exception e) {
throw new IOException("Problem starting http server", e);
}
-we'd need to catch the jetty exception and look for a nested interrupt,
throw it. Ouch.