[concurrency-interest] Future.get exception mapping

√iktor Ҡlang viktor.klang at gmail.com
Fri Jul 15 09:29:43 EDT 2011


Not to forget would be that it would be very nice to have
onComplete/onTimeout/onCancel callbacks so one could use promise pipelining
and have full asynchronizity instead of introducing blocking. :-)

Cheers,
√

On Fri, Jul 15, 2011 at 1:51 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> On 07/14/11 19:27, Chris Povirk wrote:
>
>> I'm trying to
>> simplify exception management in some common uses of concurrency
>> utilities.
>>
>
> Deja vu. We faced the same issues with ForkJoinTask, which
> are Futures, but unlike arbitrary Futures, are designed for
> uses in which checked exceptions rarely apply. We mainly solved
> this by adding method join(),
> (http://gee.cs.oswego.edu/dl/**jsr166/dist/docs/java/util/**
> concurrent/ForkJoinTask.html<http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/ForkJoinTask.html>)
> that differs from get() in that it only throws
> unchecked exceptions. We then designed all the ForkJoin execution
> mechanics to play along, including, when necessary,
> wrapping in RuntimeException. This was easier for us inside JDK
> library classes vs user-level because we could arrange the
> JVM to just rethrow Throwables that are sure to be either
> Errors or RuntimeExceptions (the two forms of unchecked
> exceptions), but there is no associated static type.
>
> If I were to do this over again, I would probably do
> the same for ALL Futures (and not even parameterize
> over Exception types). If you glance through hits
> of "catch (ExecutionException" on google code
> search (http://www.google.com/**codesearch<http://www.google.com/codesearch>),
> most
> usages would have been easier and probably closer
> to being correct if we had done so. It is too late now,
> but as people tend to start using ForkJoinTask more than
> other forms of Futures, maybe this problem will slowly go away.
>
> -Doug
>
> ______________________________**_________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.**oswego.edu <Concurrency-interest at cs.oswego.edu>
> http://cs.oswego.edu/mailman/**listinfo/concurrency-interest<http://cs.oswego.edu/mailman/listinfo/concurrency-interest>
>



-- 
Viktor Klang

Akka Tech Lead
Typesafe <http://www.typesafe.com/> - Enterprise-Grade Scala from the
Experts

Twitter: @viktorklang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110715/76bd39fa/attachment.html>


More information about the Concurrency-interest mailing list