mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8365630: jdk/jfr/tool/TestPrintContextual.java fails with wrong spanId
Reviewed-by: shade
This commit is contained in:
parent
0f406c420e
commit
2376a9e972
@ -25,6 +25,7 @@ package jdk.jfr.tool;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -264,7 +265,8 @@ public class TestPrintContextual {
|
||||
}
|
||||
}
|
||||
|
||||
private static void span(int depth) {
|
||||
private static void span(int depth) throws InterruptedException {
|
||||
awaitUniqueTimestamp();
|
||||
SpanEvent span = new SpanEvent();
|
||||
span.name = "span";
|
||||
span.spanId = depth;
|
||||
@ -277,6 +279,13 @@ public class TestPrintContextual {
|
||||
span.commit();
|
||||
}
|
||||
|
||||
private static void awaitUniqueTimestamp() throws InterruptedException {
|
||||
Instant timestamp = Instant.now();
|
||||
while (timestamp.equals(Instant.now())) {
|
||||
Thread.sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Tests that context values are only inhjected into events in the same thread.
|
||||
private static void testThreadedContext() throws Exception {
|
||||
try (Recording r = new Recording()) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user