Skip to content

Commit 8ecf113

Browse files
committed
Remove pointless parallel stream processing for classpath entries.
Since we already execute all calls to NativeImageClassLoaderSupport.LoadClassHandler#handleClassFileName via the ForkJoinPool.commonPool(), the use of parallelStream() here does not further increase parallel execution and can be replaced with a simple forEach without increasing class initialization time. Additionally, avoiding parallelStream() fixes a deadlock that was observable when only one CPU core is available (parallel streams also use the commonPool() and this can lead to a deadlock with our own use on single core systems).
1 parent 0465567 commit 8ecf113

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageClassLoaderSupport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ private void run() {
817817
initModule(moduleReference, true);
818818
}
819819

820-
classpath().parallelStream().forEach(this::loadClassesFromPath);
820+
classpath().forEach(this::loadClassesFromPath);
821821
} finally {
822822
scheduledExecutor.shutdown();
823823
}

0 commit comments

Comments
 (0)