File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
core/deployment/src/main/java/io/quarkus/runner/bootstrap
test-framework/junit5/src/main/java/io/quarkus/test/junit/launcher Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,18 @@ public class ForkJoinClassLoading {
1313 /**
1414 * A yucky hack, basically attempt to make sure every thread in the common pool has
1515 * the correct CL.
16- *
16+ * <p>
1717 * It's not perfect, but as this only affects test and dev mode and not production it is better
1818 * than nothing.
19- *
19+ * <p>
2020 * Really we should just not use the common pool at all.
21+ * <p>
22+ * TODO: This no longer works in Java 25 because the `ForkJoinPool` now does
23+ * <a href=
24+ * "https://github.com/openjdk/jdk/blob/jdk-25%2B36/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java#L2085">
25+ * this</a>, which ends up calling <a href=
26+ * "https://github.com/openjdk/jdk/blob/jdk-25%2B36/src/java.base/share/classes/java/util/concurrent/ForkJoinWorkerThread.java#L280">this</a>.
27+ * We need to figure out how to deal with this
2128 */
2229 public static void setForkJoinClassLoader (ClassLoader classLoader ) {
2330 CountDownLatch allDone = new CountDownLatch (ForkJoinPool .getCommonPoolParallelism ());
Original file line number Diff line number Diff line change @@ -87,6 +87,11 @@ public void launcherDiscoveryStarted(LauncherDiscoveryRequest request) {
8787 if (!isProductionModeTests ()) {
8888 initializeFacadeClassLoader ();
8989 adjustContextClassLoader ();
90+
91+ // we need to ensure that the Fork-Join pool will use our thread factory, otherwise the TCCL
92+ // of the threads could be wrong
93+ System .setProperty ("java.util.concurrent.ForkJoinPool.common.threadFactory" ,
94+ "io.quarkus.bootstrap.forkjoin.QuarkusForkJoinWorkerThreadFactory" );
9095 }
9196
9297 }
You can’t perform that action at this time.
0 commit comments