Skip to content

Commit

Permalink
Merge pull request #6 from jerboaa/JDK-8328366-fork-join-pool-backport
Browse files Browse the repository at this point in the history
Backport: svm: adopt "JDK-8328366: Thread.setContextClassloader from thread in FJP commonPool task no longer works after JDK-8327501"
  • Loading branch information
zakkak authored Aug 22, 2024
2 parents 18ee945 + dab7d02 commit 7ff5518
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class JDK21u3OrEarlier implements BooleanSupplier {

public static final boolean jdk21u3OrEarlier = JavaVersionUtil.JAVA_SPEC < 21 ||
(JavaVersionUtil.JAVA_SPEC == 21 && Runtime.version().update() <= 3);
(JavaVersionUtil.JAVA_SPEC == 21 && Runtime.version().update() <= 3);

@Override
public boolean getAsBoolean() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class JDK21u4OrLater implements BooleanSupplier {

public static final boolean jdk21u4OrLater = JavaVersionUtil.JAVA_SPEC > 21 ||
(JavaVersionUtil.JAVA_SPEC == 21 && Runtime.version().update() >= 4);
(JavaVersionUtil.JAVA_SPEC == 21 && Runtime.version().update() >= 4);

@Override
public boolean getAsBoolean() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.nio.charset.CharsetDecoder;
import java.security.AccessControlContext;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ForkJoinPool;
Expand Down Expand Up @@ -386,6 +387,15 @@ private static synchronized ForkJoinPool initializeCommonPool() {
}
}

@TargetClass(value = java.util.concurrent.ForkJoinPool.class, innerClass = "DefaultForkJoinWorkerThreadFactory", onlyWith = JDK21OrLater.class)
@SuppressWarnings("removal")
final class Target_java_util_concurrent_ForkJoinPool_DefaultForkJoinWorkerThreadFactory {
@Alias @RecomputeFieldValue(kind = Reset) //
static AccessControlContext regularACC;
@Alias @RecomputeFieldValue(kind = Reset) //
static AccessControlContext commonACC;
}

/** Dummy class to have a class with the file's name. */
public final class RecomputedFields {
}

0 comments on commit 7ff5518

Please sign in to comment.