RFR: 8370636: com/sun/jdi/TwoThreadsTest.java should wait for completion of all threads
Francesco Andreuzzi
fandreuzzi at openjdk.org
Sat Oct 25 19:35:07 UTC 2025
On Fri, 24 Oct 2025 20:20:14 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:
> Test
> com/sun/jdi/TwoThreadsTest.java
> start new threads using DebuggeeWrapper.newThread()
> and exit immediately.
>
> It is needed to jon() threads so test really works for virtual threads.
>
> I looked on other threads that use DebuggeeWrapper.newThread(). Seems most of them already updated to join spawned threads.
>
> Tested by running test on all platfrom with and wihtout virtual threads.
test/jdk/com/sun/jdi/TwoThreadsTest.java line 58:
> 56: t1.start();
> 57: t2.start();
> 58: // The threads might be virutal and daemon, so wait until completion.
Suggestion:
// The threads might be virtual and daemon, so wait until completion.
test/jdk/com/sun/jdi/TwoThreadsTest.java line 62:
> 60: t1.join();
> 61: t2.join();
> 62: } catch (InterruptedException e) {
Since anyway you're just wrapping the exception, perhaps adding `throws InterruptedException` to `main` would achieve the same effect?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27982#discussion_r2463007176
PR Review Comment: https://git.openjdk.org/jdk/pull/27982#discussion_r2463007541
More information about the serviceability-dev
mailing list