[concurrency-interest] Future.get exception mapping

Nichole King nichole.king at gmail.com
Sat Jul 16 21:14:02 EDT 2011

Wanted to clarify that if the JDK did allow parameterized exceptions without erasure, that supplying a list
of exceptions to your concurrent API would be even better as JDK 7 allows for multiple exceptions in a single catch
so you'd be able to code for those in your try/catch on one block and then cancel, interrupted, and execution
in their own.   

The existing structure in FutureTask allows you to recover any exception you're interested in via executionexception's
getcause as you mentioned by the way.

But, back to the main question, can you recycle all exceptions that are not cancel, interrupted, and execution
into one exception specified by the developer if you wanted to?  And that again points me right back to the previous
paragraph, but continuing on the track of other solutions:
     Specializing Callable and the exception of interest as an argument to a class like FutureTask is one part
of a solution, but it still requires that the try/catch structure around running the injected callable be handled
in specialized manner too.  FutureTask's implementation of that section of logic is in FutureTask$Sync.innerRun().
Redesigning those 2 elements to be injectable as one in a thread safe manner?  

More information about the Concurrency-interest mailing list