On Wed, 10 Mar 2021 23:12:47 GMT, Alex Menkov <[email protected]> wrote:
> The fix updates the test to skip ThreadStartEvent/ThreadDeathEvent from other
> threads
test/hotspot/jtreg/vmTestbase/nsk/share/jdi/JDIBase.java line 171:
> 169: // Waiting for ThreadStart and ThreadDeath event we can get events
> from system threads,
> 170: // so need to ensure we get the event from the desired thread.
> 171: protected void waitThreadStart(String threadName) throws
> JDITestRuntimeException {
I think this API is misnamed. It's not just waiting for a ThreadStart for the
specified thread. It's waiting for any event other than ThreadStart for some
other thread or ThreadDeath for any thread. That's a bit of an odd combination,
and certainly not obvious based on the method name and description.
test/hotspot/jtreg/vmTestbase/nsk/share/jdi/JDIBase.java line 185:
> 183: }
> 184: // log the event and wait for next one
> 185: log2("Waiting for ThreadStartEvent, got " + event);
This message is misleading. It could in fact be a ThreadStart, but for some
other thread other than the named thread. I think the code would be clearer if
there was no fall-through case. Put this code in an else, but also include a
different message as part of the else for the `if
(evt.thread().name().equals(threadName))` section. Maybe say something like
"...got ThreadStartEvent for wrong thread".
-------------
PR: https://git.openjdk.java.net/jdk/pull/2927