|
what to do about InterruptedException in ThreadPoolExecutor.awaitTerminatio: msg#00019java.jsr.166-concurrency
Hi! I am using a ThreadPoolExecutor to run invoke concurrently different methods on an object. Before continuing, I am interested if the task was finished: 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 Currently, because I couldn't find a good answer to my question, I am just ignoring it and it looks like things are working as expected (and I have a couple of test covering the code). I have also tried the 2nd option and I am getting the same results, so I am wondering if I am safe with the 3rd option or should I do the 2nd one. thanks in advance for all your advise, ./alex -- .w( the_mindstorm )p.
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Question on JCIP annotations, Brian Goetz |
|---|---|
| Next by Date: | Re: what to do about InterruptedException inThreadPoolExecutor.awaitTermination, Dawid Kurzyniec |
| Previous by Thread: | Question on JCIP annotations, Holger Hoffstätte |
| Next by Thread: | Re: what to do about InterruptedException inThreadPoolExecutor.awaitTermination, Dawid Kurzyniec |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |