On 15/03/2013 12:00, Doug Lea wrote:
On 03/14/13 23:25, Martin Buchholz wrote:
Doing a mini-audit of these methods, here is a change to what seems to
be the
intent:

Yes, thanks! This keeps the exception specs consistent across similar
methods.

Now that I reread these method descriptions, I think thenAcceptBothXXX suffer the same problem:

diff -u -U 7 CompletableFuture.java_FROM_WEBREV.00 CompletableFuture.java
--- CompletableFuture.java_FROM_WEBREV.00       Fri Mar 15 11:43:32 2013
+++ CompletableFuture.java      Fri Mar 15 13:39:09 2013
@@ -412,14 +412,15 @@

     /* ------------- Async tasks -------------- */

     /**
      * A tagging interface identifying asynchronous tasks produced by
      * {@code async} methods. This may be useful for monitoring,
      * debugging, and tracking asynchronous activities.
+     * @since 1.8
      */
     public static interface AsynchronousCompletionTask {
     }

     /** Base class can act as either FJ or plain Runnable */
     abstract static class Async extends ForkJoinTask<Void>
         implements Runnable, AsynchronousCompletionTask {
@@ -2008,19 +2009,19 @@
         helpPostComplete();
         other.helpPostComplete();
         return dst;
     }

     /**
      * Creates and returns a CompletableFuture that is completed with
-     * the results of this and the other given CompletableFuture if
-     * both complete.  If this and/or the other CompletableFuture
-     * complete exceptionally, then the returned CompletableFuture
-     * also does so, with a CompletionException holding one of these
-     * exceptions as its cause.
+     * the result of the given function of this and the other given
+     * CompletableFuture if both complete. If this and/or the other
+     * CompletableFuture complete exceptionally, then the returned
+     * CompletableFuture also does so, with a CompletionException
+     * holding one of these exceptions as its cause.
      *
      * @param other the other CompletableFuture
      * @param block the action to perform before completing the
      * returned CompletableFuture
      * @return the new CompletableFuture
      */
     public <U> CompletableFuture<Void> thenAcceptBoth
@@ -2028,19 +2029,19 @@
          BiConsumer<? super T, ? super U> block) {
         return doThenBiAccept(other, block, null);
     }

     /**
      * Creates and returns a CompletableFuture that is completed
      * asynchronously using the {@link ForkJoinPool#commonPool()} with
-     * the results of this and the other given CompletableFuture when
-     * both complete.  If this and/or the other CompletableFuture
-     * complete exceptionally, then the returned CompletableFuture
-     * also does so, with a CompletionException holding one of these
-     * exceptions as its cause.
+     * the result of the given function of this and the other given
+     * CompletableFuture if both complete.  If this and/or the other
+     * CompletableFuture complete exceptionally, then the returned
+     * CompletableFuture also does so, with a CompletionException
+     * holding one of these exceptions as its cause.
      *
      * @param other the other CompletableFuture
      * @param block the action to perform before completing the
      * returned CompletableFuture
      * @return the new CompletableFuture
      */
     public <U> CompletableFuture<Void> thenAcceptBothAsync
@@ -2047,19 +2048,19 @@
         (CompletableFuture<? extends U> other,
          BiConsumer<? super T, ? super U> block) {
         return doThenBiAccept(other, block, ForkJoinPool.commonPool());
     }

     /**
      * Creates and returns a CompletableFuture that is completed
-     * asynchronously using the given executor with the results of
-     * this and the other given CompletableFuture when both complete.
-     * If this and/or the other CompletableFuture complete exceptionally,
-     * then the returned CompletableFuture also does so, with a
-     * CompletionException holding one of these exceptions as its cause.
+     * asynchronously using the given executor with the results of the
+     * given function of this and the other given CompletableFuture if
+     * both complete. If this and/or the other CompletableFuture complete
+     * exceptionally, then the returned CompletableFuture also does so,
+ * with a CompletionException holding one of these exceptions as its cause.
      *
      * @param other the other CompletableFuture
      * @param block the action to perform before completing the
      * returned CompletableFuture
      * @param executor the executor to use for asynchronous execution
      * @return the new CompletableFuture
      */



-Chris.


-Doug



Index: ./java/util/concurrent/CompletableFuture.java
===================================================================
RCS file:
/export/home/jsr166/jsr166/jsr166/src/main/java/util/concurrent/CompletableFuture.java,v

retrieving revision 1.55
diff -u -U 7 -r1.55 CompletableFuture.java
--- ./java/util/concurrent/CompletableFuture.java16 Feb 2013 21:25:55
-00001.55
+++ ./java/util/concurrent/CompletableFuture.java15 Mar 2013 03:23:26
-0000
@@ -1683,35 +1683,35 @@
*/
public CompletableFuture<Void> thenAccept(Consumer<? super T> block) {
return doThenAccept(block, null);
}
/**
* Creates and returns a CompletableFuture that is asynchronously
- * completed using the {@link ForkJoinPool#commonPool()} with this
- * CompletableFuture's result when it completes. If this
- * CompletableFuture completes exceptionally, then the returned
- * CompletableFuture also does so, with a CompletionException holding
- * this exception as its cause.
+ * completed after performing the given action using the {@link
+ * ForkJoinPool#commonPool()} with this CompletableFuture's result
+ * when it completes. If this CompletableFuture completes
+ * exceptionally, then the returned CompletableFuture also does so,
+ * with a CompletionException holding this exception as its cause.
*
* @param block the action to perform before completing the
* returned CompletableFuture
* @return the new CompletableFuture
*/
public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T>
block) {
return doThenAccept(block, ForkJoinPool.commonPool());
}
/**
* Creates and returns a CompletableFuture that is asynchronously
- * completed using the given executor with this
- * CompletableFuture's result when it completes. If this
- * CompletableFuture completes exceptionally, then the returned
- * CompletableFuture also does so, with a CompletionException holding
- * this exception as its cause.
+ * completed after performing the given action using the given
+ * executor with this CompletableFuture's result when it completes.
+ * If this CompletableFuture completes exceptionally, then the
+ * returned CompletableFuture also does so, with a CompletionException
+ * holding this exception as its cause.
*
* @param block the action to perform before completing the
* returned CompletableFuture
* @param executor the executor to use for asynchronous execution
* @return the new CompletableFuture
*/
public CompletableFuture<Void> thenAcceptAsync(Consumer<? super T> block,



On Thu, Mar 14, 2013 at 10:21 AM, Chris Hegarty <[email protected]
<mailto:[email protected]>> wrote:

As part of JEP 155 (Concurrency Updates) we are proposing to add
CompletableFuture. A Future that may be explicitly completed (setting its
value and status), and may include dependent functions and actions that
trigger upon its completion.

Specdiff:

http://cr.openjdk.java.net/~__chegar/8005696/specdiff/java/__util/concurrent/package-__summary.html

<http://cr.openjdk.java.net/~chegar/8005696/specdiff/java/util/concurrent/package-summary.html>

Webrev:
http://cr.openjdk.java.net/~__chegar/8005696/webrev.00/__webrev/
<http://cr.openjdk.java.net/~chegar/8005696/webrev.00/webrev/>

CompletableFuture, as usual, is coming from Doug Lea, with assistance
from
members of the former JCP JSR-166 Expert Group. I have already informally
reviewed this. This is an official call for review before finalizing
the API
for inclusion in jdk8.

Note:
I still need to make some additions to the test for better coverage, but
these should not be a blocker for this review.

-Chris.



Reply via email to