|
Re: proper handling of InterruptedException: msg#00075java.jsr.166-concurrency
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 they are. 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. >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: proper handling of InterruptedException, Joe Bowbeer |
|---|---|
| Next by Date: | Re: proper handling of InterruptedException, David Holmes |
| Previous by Thread: | Re: proper handling of InterruptedException, Joe Bowbeer |
| Next by Thread: | Re: proper handling of InterruptedException, David Holmes |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |