[concurrency-interest] Future.isCompletedNormally Future.isCompletedAbnormally

Luke Sandberg lukeisandberg at gmail.com
Sat Mar 7 17:27:38 EST 2015

I think these would be pretty useful (isCancelled() is pretty useful), I
would also be interested in efficient methods to get the failure cause of a
future (without paying the cost of an ExecutionException).  A lot of time
the executionexception contains no useful information (if a library is
dereferencing a users future), and so i end up discarding the EE or
replacing it with something more useful.

On Thu, Mar 5, 2015 at 11:58 AM, Martin Buchholz <martinrb at google.com>

> 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.
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20150307/6b7f1d7a/attachment.html>

More information about the Concurrency-interest mailing list