|
Re: what to do about InterruptedException inThreadPoolExecutor.awaitTermina: msg#00023java.jsr.166-concurrency
On 10/18/06, David Holmes <dcholmes@xxxxxxxxxxxxxxx> wrote: > Alex, > > > My code looks something like: > > > > [code] > > exec.submitRunnable(imr); > > exec.shutdown(); > > boolean finished= exec.awaitTermination(timeOut); > > [/code] > > > > I am trying to understand what should I do about the > > InterruptedException that can be thrown from the awaitTermination > > method. As I read in the JCiP, I should be doing one of: > > 1/ propagate it (which is not acceptable in my case) > > 2/ have something like Thread.currentThread().interrupt(); > > 3/ ignore it > > So the difference between #2 and #3 in practice is what else the thread > executing the above code does. In general you should always do #2 - it is > safe and correct no matter what thread does. #3 can be correct if the thread > does nothing else after the above code, but if you/someone changes that > later then they need to remember to convert to #2 if needed. So stick with > #2 as a general rule. > Considering my previous answer to Dawid, it looks like at least I got this one right. ./alex -- .w( the_mindstorm )p. > Cheers, > David Holmes > >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: what to do about InterruptedException inThreadPoolExecutor.awaitTermination, David Holmes |
|---|---|
| Next by Date: | Re: what to do about InterruptedException inThreadPoolExecutor.awaitTermination, Alexandru Popescu |
| Previous by Thread: | Re: what to do about InterruptedException inThreadPoolExecutor.awaitTermination, David Holmes |
| Next by Thread: | JCiP Memoizer, Alexandru Popescu |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |