< prev index next >

src/java.base/share/classes/java/util/concurrent/CountedCompleter.java

Print this page
8192944: Miscellaneous changes imported from jsr166 CVS 2017-12-08
Reviewed-by: martin, psandoz, chegar


 718      *                 processed.
 719      */
 720     public final void helpComplete(int maxTasks) {
 721         Thread t; ForkJoinWorkerThread wt;
 722         if (maxTasks > 0 && status >= 0) {
 723             if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
 724                 (wt = (ForkJoinWorkerThread)t).pool.
 725                     helpComplete(wt.workQueue, this, maxTasks);
 726             else
 727                 ForkJoinPool.common.externalHelpComplete(this, maxTasks);
 728         }
 729     }
 730 
 731     /**
 732      * Supports ForkJoinTask exception propagation.
 733      */
 734     void internalPropagateException(Throwable ex) {
 735         CountedCompleter<?> a = this, s = a;
 736         while (a.onExceptionalCompletion(ex, s) &&
 737                (a = (s = a).completer) != null && a.status >= 0 &&
 738                a.recordExceptionalCompletion(ex) == EXCEPTIONAL)
 739             ;
 740     }
 741 
 742     /**
 743      * Implements execution conventions for CountedCompleters.
 744      */
 745     protected final boolean exec() {
 746         compute();
 747         return false;
 748     }
 749 
 750     /**
 751      * Returns the result of the computation.  By default,
 752      * returns {@code null}, which is appropriate for {@code Void}
 753      * actions, but in other cases should be overridden, almost
 754      * always to return a field or function of a field that
 755      * holds the result upon completion.
 756      *
 757      * @return the result of the computation
 758      */




 718      *                 processed.
 719      */
 720     public final void helpComplete(int maxTasks) {
 721         Thread t; ForkJoinWorkerThread wt;
 722         if (maxTasks > 0 && status >= 0) {
 723             if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)
 724                 (wt = (ForkJoinWorkerThread)t).pool.
 725                     helpComplete(wt.workQueue, this, maxTasks);
 726             else
 727                 ForkJoinPool.common.externalHelpComplete(this, maxTasks);
 728         }
 729     }
 730 
 731     /**
 732      * Supports ForkJoinTask exception propagation.
 733      */
 734     void internalPropagateException(Throwable ex) {
 735         CountedCompleter<?> a = this, s = a;
 736         while (a.onExceptionalCompletion(ex, s) &&
 737                (a = (s = a).completer) != null && a.status >= 0 &&
 738                isExceptionalStatus(a.recordExceptionalCompletion(ex)))
 739             ;
 740     }
 741 
 742     /**
 743      * Implements execution conventions for CountedCompleters.
 744      */
 745     protected final boolean exec() {
 746         compute();
 747         return false;
 748     }
 749 
 750     /**
 751      * Returns the result of the computation.  By default,
 752      * returns {@code null}, which is appropriate for {@code Void}
 753      * actions, but in other cases should be overridden, almost
 754      * always to return a field or function of a field that
 755      * holds the result upon completion.
 756      *
 757      * @return the result of the computation
 758      */


< prev index next >