From 9f9de26fc5246ba018ec4b9e2cc040fadba00b41 Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Fri, 11 Oct 2024 21:37:47 +0200 Subject: [PATCH] 8341989: [21u] Back out JDK-8327501 and JDK-8328366 Reviewed-by: goetz --- .../share/classes/java/util/concurrent/ForkJoinPool.java | 4 +++- test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java index 8aafda5312e..5e698b1540f 100644 --- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java +++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java @@ -981,7 +981,9 @@ public final ForkJoinWorkerThread newThread(ForkJoinPool pool) { boolean isCommon = (pool.workerNamePrefix == null); @SuppressWarnings("removal") SecurityManager sm = System.getSecurityManager(); - if (sm != null && isCommon) + if (sm == null) + return new ForkJoinWorkerThread(null, pool, true, false); + else if (isCommon) return newCommonWithACC(pool); else return newRegularWithACC(pool); diff --git a/test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java b/test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java index a87aa7b916b..266c2a036fe 100644 --- a/test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java +++ b/test/jdk/java/util/concurrent/tck/ForkJoinPool9Test.java @@ -79,9 +79,6 @@ public void testCommonPoolThreadContextClassLoader() throws Throwable { assertSame(ForkJoinPool.commonPool(), ForkJoinTask.getPool()); Thread currentThread = Thread.currentThread(); - ClassLoader preexistingContextClassLoader = - currentThread.getContextClassLoader(); - Stream.of(systemClassLoader, null).forEach(cl -> { if (randomBoolean()) // should always be permitted, without effect @@ -98,11 +95,6 @@ public void testCommonPoolThreadContextClassLoader() throws Throwable { () -> System.getProperty("foo"), () -> currentThread.setContextClassLoader( classLoaderDistinctFromSystemClassLoader)); - else { - currentThread.setContextClassLoader(classLoaderDistinctFromSystemClassLoader); - assertSame(currentThread.getContextClassLoader(), classLoaderDistinctFromSystemClassLoader); - currentThread.setContextClassLoader(preexistingContextClassLoader); - } // TODO ? // if (haveSecurityManager // && Thread.currentThread().getClass().getSimpleName()