25
25
*
26
26
* One requirement for using the Fork/Join Framework is that all of the Subtasks
27
27
* must be "completable and independent" of each other to be truly parallel, so
28
- * not every problem can be solved using this method.
28
+ * not every problem can be solved using this method. In general, the ForkJoin Framework
29
+ * is to be used by CPU-intensive computations, not IO bound computations, due to the
30
+ * long wait periods that could happen.
29
31
*
30
32
* How it works
31
33
*
@@ -90,7 +92,7 @@ public class UsingForkJoinFramework {
90
92
* Default instance of a fork join pool in a Java app, used by
91
93
* CompletableFuture, and parallel streams. All threads used by the common pool
92
94
* can be reused, released and reinstated after some time. This approach reduces
93
- * the resource consumption.
95
+ * the resource consumption. It doesn't need to be closed/shutdown.
94
96
*
95
97
*/
96
98
public ForkJoinPool getCommonPool () {
@@ -112,8 +114,10 @@ public ForkJoinPool getCommonPool() {
112
114
* joined, like event-oriented asynchronous tasks.
113
115
*
114
116
*/
115
- public ForkJoinPool customForkJoinPool (int parallelism , ForkJoinPool .ForkJoinWorkerThreadFactory factory ,
116
- UncaughtExceptionHandler handler , boolean asyncMode ) {
117
+ public ForkJoinPool customForkJoinPool (int parallelism ,
118
+ ForkJoinPool .ForkJoinWorkerThreadFactory factory ,
119
+ UncaughtExceptionHandler handler ,
120
+ boolean asyncMode ) {
117
121
return new ForkJoinPool (parallelism , factory , handler , asyncMode );
118
122
}
119
123
0 commit comments