Skip to content

Commit b03363c

Browse files
committed
cleanup
1 parent 035db7f commit b03363c

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

Diff for: dd-trace-api/src/main/java/datadog/trace/context/TraceScope.java

+30-30
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,36 @@ public interface TraceScope extends Closeable {
1111
@Override
1212
void close();
1313

14+
/**
15+
* Used to pass async context between workers. A trace will not be reported until all spans and
16+
* continuations are resolved. You must call activate (and close on the returned scope) or cancel
17+
* on each continuation to avoid discarding traces.
18+
*/
19+
interface Continuation {
20+
21+
/**
22+
* Prevent the trace attached to this scope from reporting until the continuation is explicitly
23+
* cancelled. You must call {@link #cancel()} at some point to avoid discarding traces.
24+
*
25+
* <p>Use this when you want to let multiple threads activate the continuation concurrently and
26+
* close their scopes without fear of prematurely closing the related span.
27+
*/
28+
Continuation hold();
29+
30+
/**
31+
* Activate the continuation.
32+
*
33+
* <p>Should be called on the child thread.
34+
*
35+
* <p>Consider calling this in a try-with-resources initialization block to ensure the returned
36+
* scope is closed properly.
37+
*/
38+
TraceScope activate();
39+
40+
/** Allow trace to stop waiting on this continuation for reporting. */
41+
void cancel();
42+
}
43+
1444
/**
1545
* @deprecated Replaced by {@link Tracer#captureActiveSpan()}.
1646
* <p>Prevent the <strong>currently active trace</strong>, which may differ from this scope
@@ -51,34 +81,4 @@ default boolean isAsyncPropagating() {
5181
default void setAsyncPropagation(boolean value) {
5282
GlobalTracer.get().setAsyncPropagationEnabled(value);
5383
}
54-
55-
/**
56-
* Used to pass async context between workers. A trace will not be reported until all spans and
57-
* continuations are resolved. You must call activate (and close on the returned scope) or cancel
58-
* on each continuation to avoid discarding traces.
59-
*/
60-
interface Continuation {
61-
62-
/**
63-
* Prevent the trace attached to this scope from reporting until the continuation is explicitly
64-
* cancelled. You must call {@link #cancel()} at some point to avoid discarding traces.
65-
*
66-
* <p>Use this when you want to let multiple threads activate the continuation concurrently and
67-
* close their scopes without fear of prematurely closing the related span.
68-
*/
69-
Continuation hold();
70-
71-
/**
72-
* Activate the continuation.
73-
*
74-
* <p>Should be called on the child thread.
75-
*
76-
* <p>Consider calling this in a try-with-resources initialization block to ensure the returned
77-
* scope is closed properly.
78-
*/
79-
TraceScope activate();
80-
81-
/** Allow trace to stop waiting on this continuation for reporting. */
82-
void cancel();
83-
}
8484
}

0 commit comments

Comments
 (0)