|
Re: proper handling of InterruptedException: msg#00074java.jsr.166-concurrency
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 possible. 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@xxxxxxxxxxxxxx> 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? >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | proper handling of InterruptedException, Moran Avigdor |
|---|---|
| Next by Date: | Re: proper handling of InterruptedException, Brian Goetz |
| Previous by Thread: | proper handling of InterruptedException, Moran Avigdor |
| Next by Thread: | Re: proper handling of InterruptedException, Brian Goetz |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |