5151import java .util .function .Predicate ;
5252import java .util .concurrent .CountDownLatch ;
5353import java .util .concurrent .locks .LockSupport ;
54+
55+ import jdk .internal .access .JavaLangAccess ;
5456import jdk .internal .access .JavaUtilConcurrentFJPAccess ;
5557import jdk .internal .access .SharedSecrets ;
5658import jdk .internal .misc .Unsafe ;
@@ -1133,9 +1135,7 @@ static final class DefaultForkJoinWorkerThreadFactory
11331135 implements ForkJoinWorkerThreadFactory {
11341136 public final ForkJoinWorkerThread newThread (ForkJoinPool pool ) {
11351137 boolean isCommon = (pool .workerNamePrefix == null );
1136- @ SuppressWarnings ("removal" )
1137- SecurityManager sm = System .getSecurityManager ();
1138- if (sm != null && isCommon )
1138+ if (isCommon && JLA .allowSecurityManager ())
11391139 return newCommonWithACC (pool );
11401140 else
11411141 return newRegularWithACC (pool );
@@ -1152,6 +1152,8 @@ public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
11521152 @ SuppressWarnings ("removal" )
11531153 static volatile AccessControlContext regularACC , commonACC ;
11541154
1155+ private static final JavaLangAccess JLA = SharedSecrets .getJavaLangAccess ();
1156+
11551157 @ SuppressWarnings ("removal" )
11561158 static ForkJoinWorkerThread newRegularWithACC (ForkJoinPool pool ) {
11571159 AccessControlContext acc = regularACC ;
0 commit comments