Skip to content

Commit ac47a27

Browse files
committed
Add synchronisation on test methods
1 parent 01d6821 commit ac47a27

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

internal-api/src/main/java/datadog/trace/api/ProcessTags.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,19 @@ public static UTF8BytesString getTagsForSerialization() {
138138

139139
/** Visible for testing. */
140140
static void empty() {
141-
Lazy.TAGS.clear();
142-
Lazy.serializedForm = null;
143-
Lazy.listForm = null;
141+
synchronized (Lazy.TAGS) {
142+
Lazy.TAGS.clear();
143+
Lazy.serializedForm = null;
144+
Lazy.listForm = null;
145+
}
144146
}
145147

146148
/** Visible for testing. */
147149
static void reset() {
148-
empty();
149-
enabled = Config.get().isExperimentalPropagateProcessTagsEnabled();
150-
Lazy.TAGS.putAll(Lazy.loadTags());
150+
synchronized (Lazy.TAGS) {
151+
empty();
152+
enabled = Config.get().isExperimentalPropagateProcessTagsEnabled();
153+
Lazy.TAGS.putAll(Lazy.loadTags());
154+
}
151155
}
152156
}

0 commit comments

Comments
 (0)