8307486: ProcessTools.java should wait until vthread is completed before checking exceptions

Reviewed-by: dholmes, alanb
This commit is contained in:
Leonid Mesnik 2023-05-09 16:36:21 +00:00
parent 44fa12e751
commit 3aff5eacbd

View File

@ -895,10 +895,10 @@ public final class ProcessTools {
tg.uncaughtThrowable = error;
}
});
if (tg.uncaughtThrowable != null) {
throw new RuntimeException(tg.uncaughtThrowable);
}
vthread.join();
if (tg.uncaughtThrowable != null) {
throw tg.uncaughtThrowable;
}
} else if (wrapper.equals("Kernel")) {
MainThreadGroup tg = new MainThreadGroup();
Thread t = new Thread(tg, () -> {
@ -913,7 +913,7 @@ public final class ProcessTools {
t.start();
t.join();
if (tg.uncaughtThrowable != null) {
throw new RuntimeException(tg.uncaughtThrowable);
throw tg.uncaughtThrowable;
}
} else {
mainMethod.invoke(null, new Object[] { classArgs });