[concurrency-interest] proper handling of InterruptedException
brian at quiotix.com
Mon Oct 30 18:52:45 EST 2006
The cardinal rule is: Never hide the fact that an interruption occurred.
So, your choices are:
- Throw IE yourself
- Re-set the interrupted bit (Thread.currentThread().interrupt())
- Handle the interruption
The classes in JUC (like BlockingQueue and Semaphore) throw IE since
their caller is in a better position to deal with the interruption than
Lots more detail in JCiP Ch 7.
Moran Avigdor 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?
> Thank you.
More information about the Concurrency-interest