[concurrency-interest] proper handling of InterruptedException

Joe Bowbeer joe.bowbeer at gmail.com
Mon Oct 30 18:37:05 EST 2006

If interrupts are used as the primary means of cancellation then I
prefer that blocking methods be interruptible and that all
interruptible methods declare "throws InterruptedException" -- and
that InterruptedExceptions "happen" with as little interference as

This is simple to implement at the sight of the interrupt and, at
runtime, results in a clear record of where the interrupt was
detected. It also encourages a kind of rigor wrt exceptions and
shutdown that is good for you :-)

Note that even if your method throws InterruptedException, it still
might need to catch the exception before rethrowing it, for example if
some post-interrupt cleanup is needed.

On 10/30/06, Moran Avigdor <moran at gigaspaces.com> wrote:
> A question arose, your opinions are welcome -
> What is considered a proper handling of InterrupedException?
> Is it a common practice to throw InterruptedException when the thread
> was interrupted while waiting?
> or should the thread catch it, ignore it and gracefully die?

More information about the Concurrency-interest mailing list