8023103: FJ parallelism zero
authordl
Thu, 15 Aug 2013 15:01:37 +0100
changeset 19412 e7847bc5763b
parent 19411 b8942467963c
child 19413 56082c988815
8023103: FJ parallelism zero 8020537: java/util/concurrent/forkjoin/ThrowingRunnable.java Reviewed-by: chegar, mduigou, alanb
jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Tue Aug 13 13:04:21 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Thu Aug 15 15:01:37 2013 +0100
@@ -144,7 +144,8 @@
  * Upon any error in establishing these settings, default parameters
  * are used. It is possible to disable or limit the use of threads in
  * the common pool by setting the parallelism property to zero, and/or
- * using a factory that may return {@code null}.
+ * using a factory that may return {@code null}. However doing so may
+ * cause unjoined tasks to never be executed.
  *
  * <p><b>Implementation notes</b>: This implementation restricts the
  * maximum number of running threads to 32767. Attempts to create
@@ -3303,8 +3304,8 @@
         }
 
         if (parallelism < 0 && // default 1 less than #cores
-            (parallelism = Runtime.getRuntime().availableProcessors() - 1) < 0)
-            parallelism = 0;
+            (parallelism = Runtime.getRuntime().availableProcessors() - 1) <= 0)
+            parallelism = 1;
         if (parallelism > MAX_CAP)
             parallelism = MAX_CAP;
         return new ForkJoinPool(parallelism, factory, handler, LIFO_QUEUE,