< prev index next >

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

Print this page
8211283: Miscellaneous changes imported from jsr166 CVS 2018-11
Reviewed-by: martin, chegar


1213      * is not known to have been completed.  This method is designed
1214      * to aid debugging, as well as to support extensions. Its use in
1215      * any other context is discouraged.
1216      *
1217      * @return the result, or {@code null} if not completed
1218      */
1219     public abstract V getRawResult();
1220 
1221     /**
1222      * Forces the given value to be returned as a result.  This method
1223      * is designed to support extensions, and should not in general be
1224      * called otherwise.
1225      *
1226      * @param value the value
1227      */
1228     protected abstract void setRawResult(V value);
1229 
1230     /**
1231      * Immediately performs the base action of this task and returns
1232      * true if, upon return from this method, this task is guaranteed
1233      * to have completed normally. This method may return false
1234      * otherwise, to indicate that this task is not necessarily
1235      * complete (or is not known to be complete), for example in
1236      * asynchronous actions that require explicit invocations of
1237      * completion methods. This method may also throw an (unchecked)
1238      * exception to indicate abnormal exit. This method is designed to
1239      * support extensions, and should not in general be called
1240      * otherwise.
1241      *
1242      * @return {@code true} if this task is known to have completed normally
1243      */
1244     protected abstract boolean exec();
1245 
1246     /**
1247      * Returns, but does not unschedule or execute, a task queued by
1248      * the current thread but not yet executed, if one is immediately
1249      * available. There is no guarantee that this task will actually
1250      * be polled or executed next. Conversely, this method may return
1251      * null even if a task exists but cannot be accessed without
1252      * contention with other threads.  This method is designed
1253      * primarily to support extensions, and is unlikely to be useful
1254      * otherwise.
1255      *
1256      * @return the next task, or {@code null} if none are available
1257      */
1258     protected static ForkJoinTask<?> peekNextLocalTask() {
1259         Thread t; ForkJoinPool.WorkQueue q;
1260         if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)




1213      * is not known to have been completed.  This method is designed
1214      * to aid debugging, as well as to support extensions. Its use in
1215      * any other context is discouraged.
1216      *
1217      * @return the result, or {@code null} if not completed
1218      */
1219     public abstract V getRawResult();
1220 
1221     /**
1222      * Forces the given value to be returned as a result.  This method
1223      * is designed to support extensions, and should not in general be
1224      * called otherwise.
1225      *
1226      * @param value the value
1227      */
1228     protected abstract void setRawResult(V value);
1229 
1230     /**
1231      * Immediately performs the base action of this task and returns
1232      * true if, upon return from this method, this task is guaranteed
1233      * to have completed. This method may return false otherwise, to
1234      * indicate that this task is not necessarily complete (or is not
1235      * known to be complete), for example in asynchronous actions that
1236      * require explicit invocations of completion methods. This method
1237      * may also throw an (unchecked) exception to indicate abnormal
1238      * exit. This method is designed to support extensions, and should
1239      * not in general be called otherwise.

1240      *
1241      * @return {@code true} if this task is known to have completed normally
1242      */
1243     protected abstract boolean exec();
1244 
1245     /**
1246      * Returns, but does not unschedule or execute, a task queued by
1247      * the current thread but not yet executed, if one is immediately
1248      * available. There is no guarantee that this task will actually
1249      * be polled or executed next. Conversely, this method may return
1250      * null even if a task exists but cannot be accessed without
1251      * contention with other threads.  This method is designed
1252      * primarily to support extensions, and is unlikely to be useful
1253      * otherwise.
1254      *
1255      * @return the next task, or {@code null} if none are available
1256      */
1257     protected static ForkJoinTask<?> peekNextLocalTask() {
1258         Thread t; ForkJoinPool.WorkQueue q;
1259         if ((t = Thread.currentThread()) instanceof ForkJoinWorkerThread)


< prev index next >