Skip to content
Permalink
Browse files
8273909: vmTestbase/nsk/jdi/Event/request/request001 can still fail w…
…ith "ERROR: new event is not ThreadStartEvent"

Reviewed-by: cjplummer, sspitsyn
  • Loading branch information
Alex Menkov committed Sep 20, 2021
1 parent 04891c9 commit 5fde4b64e25a3b3a4c01c57064624b9f930a1324
@@ -335,7 +335,6 @@ private void testRun()

log2("......setting up ThreadStartRequest");
ThreadStartRequest tsr = eventRManager.createThreadStartRequest();
tsr.addCountFilter(1);
tsr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
tsr.putProperty("number", "ThreadStartRequest");
tsr.enable();
@@ -344,7 +343,6 @@ private void testRun()

log2("......setting up ThreadDeathRequest");
ThreadDeathRequest tdr = eventRManager.createThreadDeathRequest();
tdr.addCountFilter(1);
tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
tsr.putProperty("number", "ThreadDeathRequest");
tdr.enable();
@@ -324,7 +324,6 @@ private void testRun()

log2("......setting up ThreadStartRequest");
ThreadStartRequest tsr = eventRManager.createThreadStartRequest();
tsr.addCountFilter(1);
tsr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
tsr.putProperty("number", "ThreadStartRequest");
tsr.enable();
@@ -333,7 +332,6 @@ private void testRun()

log2("......setting up ThreadDeathRequest");
ThreadDeathRequest tdr = eventRManager.createThreadDeathRequest();
tdr.addCountFilter(1);
tdr.setSuspendPolicy(EventRequest.SUSPEND_ALL);
tsr.putProperty("number", "ThreadDeathRequest");
tdr.enable();
@@ -279,21 +279,18 @@ private void testRun()
log2("......setting up ThreadDeathRequest");
ThreadDeathRequest tdr1 = eventRManager.createThreadDeathRequest();
// tdr1.addThreadFilter(mainThread);
tdr1.addCountFilter(1);
tdr1.setSuspendPolicy(EventRequest.SUSPEND_ALL);
tdr1.putProperty("number", "ThreadDeathRequest1");
tdr1.enable();

ThreadDeathRequest tdr2 = eventRManager.createThreadDeathRequest();
// tsr2.addThreadFilter(mainThread);
tdr2.addCountFilter(1);
tdr2.setSuspendPolicy(EventRequest.SUSPEND_ALL);
tdr2.putProperty("number", "ThreadDeathRequest2");
tdr2.enable();

ThreadDeathRequest tdr3 = eventRManager.createThreadDeathRequest();
tdr3.addThreadFilter(testThread);
tdr3.addCountFilter(1);
tdr3.setSuspendPolicy(EventRequest.SUSPEND_ALL);
tdr3.putProperty("number", "ThreadDeathRequest3");
tdr3.enable();
@@ -157,27 +157,29 @@ protected final void getEventSet() throws JDITestRuntimeException {
// we can get the events from system threads unexpected for tests.
// The method skips ThreadStartEvent/ThreadDeathEvent events
// for all threads except the expected one.
// Note: don't limit ThreadStartRequest/ThreadDeathRequest request by addCountFilter(),
// as it limits the requested event to be reported at most once.
protected void getEventSetForThreadStartDeath(String threadName) throws JDITestRuntimeException {
boolean gotDesiredEvent = false;
while (!gotDesiredEvent) {
while (true) {
getEventSet();
Event event = eventIterator.nextEvent();
if (event instanceof ThreadStartEvent evt) {
if (evt.thread().name().equals(threadName)) {
gotDesiredEvent = true;
} else {
log2("Got ThreadStartEvent for wrong thread: " + event);
break;
}
log2("Got ThreadStartEvent for '" + evt.thread().name()
+ "' instead of '" + threadName + "', skipping");
} else if (event instanceof ThreadDeathEvent evt) {
if (evt.thread().name().equals(threadName)) {
gotDesiredEvent = true;
} else {
log2("Got ThreadDeathEvent for wrong thread: " + event);
break;
}
log2("Got ThreadDeathEvent for '" + evt.thread().name()
+ "' instead of '" + threadName + "', skipping");
} else {
// not ThreadStartEvent nor ThreadDeathEvent
gotDesiredEvent = true;
break;
}
eventSet.resume();
}
// reset the iterator before return
eventIterator = eventSet.eventIterator();

1 comment on commit 5fde4b6

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 5fde4b6 Sep 20, 2021

Please sign in to comment.