[concurrency-interest] Future.isCompletedNormally Future.isCompletedAbnormally

Martin Buchholz martinrb at google.com
Thu Mar 5 14:58:09 EST 2015


Perhaps Doug can explain why isCompletedNormally and isCompletedAbnormally
landed in ForkJoinTask but no other Future implementation.

On Thu, Mar 5, 2015 at 11:07 AM, thurstonn <thurston at nomagicsoftware.com>
wrote:

>
> > All of the is* methods would (obviously) have the same happens-before
> > semantics.
>
> But that's deliberate - isDone() can't have any specified memory
> consistency
> rules, since
> the following **doesn't** hold:
>  isDone == true iff isCompletedNormally() == true
>
>
I don't see why that's true.  I expect the action in the thread that makes
the future done (setting result or exceptional value) happens-before
actions isDone returning true


> The usefulness of isCompletedNormally() would lie exactly in this, e,g,
>
> if (f.isCompletedNormally())
>    do something  //all done
> else if (waitedlongenough())
>    f.cancel()
>    schedule a backup/replacement execution
>
>
I don't think eliding the try/catch block is good motivation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20150305/972ea2b4/attachment.html>


More information about the Concurrency-interest mailing list