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

ForkJoinPool.getCommonPoolParallelism() reports always 1

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b17
    • CPU:
      x86_64
    • OS:
      windows_10
    • Verification:
      Verified

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Win10 20H2 (Build19042.868)
      Java: 17-ea+11-835
      CPU: i7-8700K

      A DESCRIPTION OF THE PROBLEM :
      A call to ForkJoinPool.getCommonPoolParallelism() will report "1" on my machine (JDK 16 = 11!)

      If you think its a "special" problem on my machine - contact me.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just run getCommonPoolParallelism()

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Version: java.version: 16, OpenJDK 64-Bit Server VM, 16+36-2231
      OS: Windows 10 Version 10.0 (amd64)
      CPUs: 12
      fjp: 11
      ACTUAL -
      Version: java.version: 17-ea, OpenJDK 64-Bit Server VM, 17-ea+11-835
      OS: Windows 10 Version 10.0 (amd64)
      CPUs: 12
      fjp: 1

      ---------- BEGIN SOURCE ----------
      public class TestFjp {

      public static void main(String[] args) {
      System.out.println("Version: " + getJavaVersion());
      System.out.println("OS: " + getOsInofrmation());
      System.out.println("CPUs: " + Runtime.getRuntime().availableProcessors());
      System.out.println("fjp: " + ForkJoinPool.getCommonPoolParallelism());
      }

      private static String getJavaVersion() {
      return "java.version: " //
      + System.getProperty("java.version")//
      + ", " + System.getProperty("java.vm.name")//
      + ", " + System.getProperty("java.runtime.version");
      }

      private static String getOsInofrmation() {
      return System.getProperty("os.name") + " Version "
      + System.getProperty("os.version") + " (" + System.getProperty("os.arch") + ") ";
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using "Runtime.getRuntime().availableProcessors())" won't work on foreign software.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dl Doug Lea
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: