changeset 14861:0c39a12473c9

8249846: Change of behavior after JDK-8237117: Better ForkJoinPool behavior Reviewed-by: mbalao
author alvdavi
date Thu, 26 Nov 2020 10:43:01 -0300
parents 401773a77147
children 93c777477e2c
files src/share/classes/java/util/concurrent/ForkJoinPool.java test/java/util/concurrent/forkjoin/AccessControlContext.java
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/concurrent/ForkJoinPool.java	Wed Nov 25 12:31:03 2020 -0500
+++ b/src/share/classes/java/util/concurrent/ForkJoinPool.java	Thu Nov 26 10:43:01 2020 -0300
@@ -728,7 +728,7 @@
     static final class DefaultForkJoinWorkerThreadFactory
         implements ForkJoinWorkerThreadFactory {
         public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
-            return new ForkJoinWorkerThread(pool, true);
+            return new ForkJoinWorkerThread(pool);
         }
     }
 
@@ -3427,7 +3427,7 @@
         }
         if (factory == null) {
             if (System.getSecurityManager() == null)
-                factory = defaultForkJoinWorkerThreadFactory;
+                factory = new DefaultCommonPoolForkJoinWorkerThreadFactory();
             else // use security-managed default
                 factory = new InnocuousForkJoinWorkerThreadFactory();
         }
@@ -3441,6 +3441,16 @@
     }
 
     /**
+     * Default factory for the common pool
+     */
+    static final class DefaultCommonPoolForkJoinWorkerThreadFactory
+        implements ForkJoinWorkerThreadFactory {
+        public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
+            return new ForkJoinWorkerThread(pool, true);
+        }
+    }
+
+    /**
      * Factory for innocuous worker threads
      */
     static final class InnocuousForkJoinWorkerThreadFactory
--- a/test/java/util/concurrent/forkjoin/AccessControlContext.java	Wed Nov 25 12:31:03 2020 -0500
+++ b/test/java/util/concurrent/forkjoin/AccessControlContext.java	Thu Nov 26 10:43:01 2020 -0300
@@ -92,15 +92,7 @@
             testInherit();
             break;
         case "default":
-            // Case fails because of "JDK-8249846: Change of behavior after
-            // JDK-8237117: Better ForkJoinPool behavior".
-            System.out.println("Known to fail with AccessControlException since 8u262 (see JDK-8249846)");
-            try {
-                testDefault();
-                throw new RuntimeException("Pool thread has inherited permissions.");
-            } catch (AccessControlException e) {
-                System.out.println("PASSED: " + e);
-            }
+            testDefault();
             break;
         }