<div dir="ltr">I don't think the names of the existing methods is great, but it's not terrible, and the time for bike shedding the names is past.<div>(We should have objected when Doug introduced these methods)</div><div><a href="http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/CompletableFuture.html#getNow-T-">http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/CompletableFuture.html#getNow-T-</a><br></div><div><a href="http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/ForkJoinTask.html#isCompletedNormally--">http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/ForkJoinTask.html#isCompletedNormally--</a><br></div><div>I just noticed this method that Luke wants:</div><div><a href="http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/ForkJoinTask.html#getException--">http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/ForkJoinTask.html#getException--</a><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 7, 2015 at 3:32 PM, Joe Bowbeer <span dir="ltr"><<a href="mailto:joe.bowbeer@gmail.com" target="_blank">joe.bowbeer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>More comments and suggestions</div><div><br></div><div>1. I think "isCompletedAbnormally" is confusing in relation to the existing method isCancelled.  Is cancellation an abnormal completion?  I think this is debatable and therefore a point of confusion.  I think these names are clearer:</div><div><br></div><div>hasFailed()</div><div>hasCompletedWithException()</div><div><br></div><div>2. hasCompletedNormally instead of isCompletedNormally?</div><div><br></div><div>3. Would a non-blocking sibling of get() be a more basic building block for these methods? For example:<br></div><div><br></div><div>getOptional() returns an Optional that is present if f.isDone, empty if !f.isDone, and otherwise throws the usual exceptions?  (Except it does *not* throw InterruptedException?)</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>--Joe</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 7, 2015 at 2:27 PM, Luke Sandberg <span dir="ltr"><<a href="mailto:lukeisandberg@gmail.com" target="_blank">lukeisandberg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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. <br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Mar 5, 2015 at 11:58 AM, Martin Buchholz <span dir="ltr"><<a href="mailto:martinrb@google.com" target="_blank">martinrb@google.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Perhaps Doug can explain why isCompletedNormally and isCompletedAbnormally landed in ForkJoinTask but no other Future implementation.<br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Thu, Mar 5, 2015 at 11:07 AM, thurstonn <span dir="ltr"><<a href="mailto:thurston@nomagicsoftware.com" target="_blank">thurston@nomagicsoftware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> All of the is* methods would (obviously) have the same happens-before<br>
> semantics.<br>
<br>
</span>But that's deliberate - isDone() can't have any specified memory consistency<br>
rules, since<br>
the following **doesn't** hold:<br>
 isDone == true iff isCompletedNormally() == true<br>
<br></blockquote><div><br></div></span><div>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</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The usefulness of isCompletedNormally() would lie exactly in this, e,g,<br>
<br>
if (f.isCompletedNormally())<br>
   do something  //all done<br>
else if (waitedlongenough())<br>
   f.cancel()<br>
   schedule a backup/replacement execution<br>
<br></blockquote><div><br></div></span><div>I don't think eliding the try/catch block is good motivation.</div><div><br></div></div></div></div>
<br></div></div><span>_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a><br>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
<br></span></blockquote></div><br></div>
<br>_______________________________________________<br>
Concurrency-interest mailing list<br>
<a href="mailto:Concurrency-interest@cs.oswego.edu" target="_blank">Concurrency-interest@cs.oswego.edu</a><br>
<a href="http://cs.oswego.edu/mailman/listinfo/concurrency-interest" target="_blank">http://cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>