File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 3535import java .util .concurrent .TimeUnit ;
3636import java .util .concurrent .TimeoutException ;
3737
38+ import com .oracle .svm .core .util .VMError ;
39+ import com .oracle .svm .util .ReflectionUtil ;
40+
41+ import jdk .graal .compiler .serviceprovider .JavaVersionUtil ;
42+
3843/**
3944 * Pure delegate implementation to ForkJoinPool.commonPool().
4045 */
@@ -79,9 +84,29 @@ public ForkJoinTask<?> submit(Runnable task) {
7984 return ForkJoinPool .commonPool ().submit (task );
8085 }
8186
87+ @ SuppressWarnings ("unchecked" )
88+ public <T > List <Future <T >> invokeAllUninterruptibly (Collection <? extends Callable <T >> tasks ) {
89+ VMError .guarantee (JavaVersionUtil .JAVA_SPEC >= 22 , "invokeAllUninterruptibly only exits in JDK 22+" );
90+ var m = ReflectionUtil .lookupMethod (ForkJoinPool .class , "invokeAllUninterruptibly" , Collection .class );
91+ try {
92+ return (List <Future <T >>) m .invoke (ForkJoinPool .commonPool (), tasks );
93+ } catch (ReflectiveOperationException e ) {
94+ throw VMError .shouldNotReachHere (e );
95+ }
96+ }
97+
8298 @ Override
8399 public <T > List <Future <T >> invokeAll (Collection <? extends Callable <T >> tasks ) {
84- return ForkJoinPool .commonPool ().invokeAll (tasks );
100+ try {
101+ return ForkJoinPool .commonPool ().invokeAll (tasks );
102+ } catch (Throwable ex ) {
103+ throw rethrow (ex );
104+ }
105+ }
106+
107+ @ SuppressWarnings ({"unchecked" })
108+ private static <E extends Throwable > RuntimeException rethrow (Throwable ex ) throws E {
109+ throw (E ) ex ;
85110 }
86111
87112 @ Override
You can’t perform that action at this time.
0 commit comments