< prev index next >

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

Print this page




  92  *
  93  * <p>In addition to execution and lifecycle control methods, this
  94  * class provides status check methods (for example
  95  * {@link #getStealCount}) that are intended to aid in developing,
  96  * tuning, and monitoring fork/join applications. Also, method
  97  * {@link #toString} returns indications of pool state in a
  98  * convenient form for informal monitoring.
  99  *
 100  * <p>As is the case with other ExecutorServices, there are three
 101  * main task execution methods summarized in the following table.
 102  * These are designed to be used primarily by clients not already
 103  * engaged in fork/join computations in the current pool.  The main
 104  * forms of these methods accept instances of {@code ForkJoinTask},
 105  * but overloaded forms also allow mixed execution of plain {@code
 106  * Runnable}- or {@code Callable}- based activities as well.  However,
 107  * tasks that are already executing in a pool should normally instead
 108  * use the within-computation forms listed in the table unless using
 109  * async event-style tasks that are not usually joined, in which case
 110  * there is little difference among choice of methods.
 111  *
 112  * <table BORDER CELLPADDING=3 CELLSPACING=1>
 113  * <caption>Summary of task execution methods</caption>
 114  *  <tr>
 115  *    <td></td>
 116  *    <td style="text-align:center"> <b>Call from non-fork/join clients</b></td>
 117  *    <td style="text-align:center"> <b>Call from within fork/join computations</b></td>
 118  *  </tr>
 119  *  <tr>
 120  *    <td> <b>Arrange async execution</b></td>
 121  *    <td> {@link #execute(ForkJoinTask)}</td>
 122  *    <td> {@link ForkJoinTask#fork}</td>
 123  *  </tr>
 124  *  <tr>
 125  *    <td> <b>Await and obtain result</b></td>
 126  *    <td> {@link #invoke(ForkJoinTask)}</td>
 127  *    <td> {@link ForkJoinTask#invoke}</td>
 128  *  </tr>
 129  *  <tr>
 130  *    <td> <b>Arrange exec and obtain Future</b></td>
 131  *    <td> {@link #submit(ForkJoinTask)}</td>
 132  *    <td> {@link ForkJoinTask#fork} (ForkJoinTasks <em>are</em> Futures)</td>




  92  *
  93  * <p>In addition to execution and lifecycle control methods, this
  94  * class provides status check methods (for example
  95  * {@link #getStealCount}) that are intended to aid in developing,
  96  * tuning, and monitoring fork/join applications. Also, method
  97  * {@link #toString} returns indications of pool state in a
  98  * convenient form for informal monitoring.
  99  *
 100  * <p>As is the case with other ExecutorServices, there are three
 101  * main task execution methods summarized in the following table.
 102  * These are designed to be used primarily by clients not already
 103  * engaged in fork/join computations in the current pool.  The main
 104  * forms of these methods accept instances of {@code ForkJoinTask},
 105  * but overloaded forms also allow mixed execution of plain {@code
 106  * Runnable}- or {@code Callable}- based activities as well.  However,
 107  * tasks that are already executing in a pool should normally instead
 108  * use the within-computation forms listed in the table unless using
 109  * async event-style tasks that are not usually joined, in which case
 110  * there is little difference among choice of methods.
 111  *
 112  * <table class="plain">
 113  * <caption>Summary of task execution methods</caption>
 114  *  <tr>
 115  *    <td></td>
 116  *    <td style="text-align:center"> <b>Call from non-fork/join clients</b></td>
 117  *    <td style="text-align:center"> <b>Call from within fork/join computations</b></td>
 118  *  </tr>
 119  *  <tr>
 120  *    <td> <b>Arrange async execution</b></td>
 121  *    <td> {@link #execute(ForkJoinTask)}</td>
 122  *    <td> {@link ForkJoinTask#fork}</td>
 123  *  </tr>
 124  *  <tr>
 125  *    <td> <b>Await and obtain result</b></td>
 126  *    <td> {@link #invoke(ForkJoinTask)}</td>
 127  *    <td> {@link ForkJoinTask#invoke}</td>
 128  *  </tr>
 129  *  <tr>
 130  *    <td> <b>Arrange exec and obtain Future</b></td>
 131  *    <td> {@link #submit(ForkJoinTask)}</td>
 132  *    <td> {@link ForkJoinTask#fork} (ForkJoinTasks <em>are</em> Futures)</td>


< prev index next >