Skip to content

Commit 3cae134

Browse files
committed
add comment
1 parent 9cf8203 commit 3cae134

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

instrumentation/executors/bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/executors/ExecutorAdviceHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public static <T> void cleanUpAfterSubmit(
109109
exceptions.
110110
*/
111111
propagatedContext.clear();
112+
// setting the field to null removes it from the fallback map
112113
virtualField.set(task, null);
113114
}
114115
}
@@ -122,8 +123,9 @@ public static <T> void cleanPropagatedContext(
122123

123124
PropagatedContext propagatedContext = virtualField.get(task);
124125
if (propagatedContext != null) {
125-
virtualField.set(task, null);
126126
propagatedContext.clear();
127+
// setting the field to null removes it from the fallback map
128+
virtualField.set(task, null);
127129
}
128130
}
129131

instrumentation/executors/bootstrap/src/main/java/io/opentelemetry/javaagent/bootstrap/executors/TaskAdviceHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public static <T> Scope makePropagatedContextCurrent(
2222
VirtualField<T, PropagatedContext> virtualField, T task) {
2323
PropagatedContext propagatedContext = virtualField.get(task);
2424
if (propagatedContext != null) {
25+
// setting the field to null removes it from the fallback map
2526
virtualField.set(task, null);
2627
Context context = propagatedContext.getAndClear();
2728
if (context != null) {

0 commit comments

Comments
 (0)