File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 25
25
26
26
import java .nio .file .Files ;
27
27
import java .nio .file .Path ;
28
+ import java .time .Instant ;
28
29
import java .util .AbstractMap ;
29
30
import java .util .ArrayList ;
30
31
import java .util .List ;
@@ -264,7 +265,8 @@ private static void testDeepContext() throws Exception {
264
265
}
265
266
}
266
267
267
- private static void span (int depth ) {
268
+ private static void span (int depth ) throws InterruptedException {
269
+ awaitUniqueTimestamp ();
268
270
SpanEvent span = new SpanEvent ();
269
271
span .name = "span" ;
270
272
span .spanId = depth ;
@@ -277,6 +279,13 @@ private static void span(int depth) {
277
279
span .commit ();
278
280
}
279
281
282
+ private static void awaitUniqueTimestamp () throws InterruptedException {
283
+ Instant timestamp = Instant .now ();
284
+ while (timestamp .equals (Instant .now ())) {
285
+ Thread .sleep (1 );
286
+ }
287
+ }
288
+
280
289
// Tests that context values are only inhjected into events in the same thread.
281
290
private static void testThreadedContext () throws Exception {
282
291
try (Recording r = new Recording ()) {
You can’t perform that action at this time.
0 commit comments