mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-21 21:33:07 +00:00
8244149: jdk/jfr/api/consumer/recordingstream/TestOnEvent.java times out
Reviewed-by: mgronlun
This commit is contained in:
parent
df182ea6e0
commit
600319b68a
@ -26,6 +26,7 @@
|
||||
package jdk.jfr.api.consumer.recordingstream;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import jdk.jfr.Event;
|
||||
import jdk.jfr.Name;
|
||||
@ -96,7 +97,7 @@ public class TestOnEvent {
|
||||
System.out.println("testTwoEventWithSameName" + e);
|
||||
eventA.countDown();
|
||||
});
|
||||
r.startAsync();
|
||||
start(r);
|
||||
EventA a1 = new EventA();
|
||||
a1.commit();
|
||||
EventAlsoA a2 = new EventAlsoA();
|
||||
@ -124,7 +125,7 @@ public class TestOnEvent {
|
||||
}
|
||||
});
|
||||
|
||||
r.startAsync();
|
||||
start(r);
|
||||
EventA a = new EventA();
|
||||
a.commit();
|
||||
EventC c = new EventC();
|
||||
@ -142,7 +143,7 @@ public class TestOnEvent {
|
||||
r.onEvent(e -> {
|
||||
event.countDown();
|
||||
});
|
||||
r.startAsync();
|
||||
start(r);
|
||||
EventA a = new EventA();
|
||||
a.commit();
|
||||
event.await();
|
||||
@ -172,6 +173,18 @@ public class TestOnEvent {
|
||||
}
|
||||
}
|
||||
|
||||
// Starts recording stream and ensures stream
|
||||
// is receiving events before method returns.
|
||||
private static void start(RecordingStream rs) throws InterruptedException {
|
||||
CountDownLatch started = new CountDownLatch(1);
|
||||
rs.onFlush(() -> {
|
||||
if (started.getCount() > 0) {
|
||||
started.countDown();
|
||||
}
|
||||
});
|
||||
rs.startAsync();
|
||||
started.await();
|
||||
}
|
||||
|
||||
private static void log(String msg) {
|
||||
System.out.println(msg);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user