Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8023103

FJ parallelism zero

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs

      Source changes that follow Doug's mail on lambda-libs-spec-observers

      http://mail.openjdk.java.net/pipermail/lambda-libs-spec-observers/2013-August/002361.html

      These changes are already in the jsr166 CVS, and there is a test in OpenJDK that verifies the change.

      diff --git a/src/share/classes/java/util/concurrent/ForkJoinPool.java b/src/share/classes/java/util/concurrent/ForkJoinPool.java
      --- a/src/share/classes/java/util/concurrent/ForkJoinPool.java
      +++ b/src/share/classes/java/util/concurrent/ForkJoinPool.java
      @@ -144,7 +144,8 @@ import java.util.concurrent.TimeUnit;
        * 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 @@ public class ForkJoinPool extends Abstra
               }

               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,

            chegar Chris Hegarty
            chegar Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: