[concurrency-interest] Exception handling & Executors

Dawid Kurzyniec dawidk at mathcs.emory.edu
Wed Oct 26 00:17:18 EDT 2005

Tim Peierls wrote:

> Joe Bowbeer wrote:
>> I meant:
>> executor.execute(runnable)
>> This gives you the most control over the actual task that is
>> executing.  For example, your task could be a custom FutureTask with a
>> done() method specialized for handling OOME.
>> To isolate the impact, you could create a "task factory" that took a
>> runnable and returned a FutureTask customized for OOME handling.
>> Or (and this is probably the best solution for you) you could create a
>> custom ExecutorService that did this for you, by extending
>> AbstractExecutorService.
> Specifically, with something like this:

>       public void execute(Runnable runnable) {
>           exec.execute(runnable);
>       }


This seems to require "And", not "Or": in the above, you still cannot 
pass a FutureTask to execute(), or it will swallow the throwable. 
Instead, you need to use OomeHandlingFutureTask, or just a plain 
runnables that do not catch Throwable.


More information about the Concurrency-interest mailing list