[concurrency-interest] backport: unchecked exceptions swallowed by executor service

Gregg Wonderly gergg at cox.net
Tue May 2 19:34:43 EDT 2006


Andrew Lentvorski wrote:
> I now wrap all code that might let exceptions into Executor/Callables 
> like so:
> 
>>         public Object captiveCall() throws InterruptedException, 
>> IOException {
>>             return obj;
>>         }
>>        
>>         public Object call() throws Exception {
>>             Object retval = null;
>>             try {
>>                 retval = captiveCall();
>>             } catch (InterruptedException e) {

This is an important pattern to utilize.  It allows you to focus your exception 
processing for your application, and then if you make the captiveCall method 
public, other applications that need different exception processing can do that. 
  I've done this for quite some time, and it is nice to see this issue come up 
on this list so that others can see this concept.

Gregg Wonderly


More information about the Concurrency-interest mailing list