File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed
internal-api/src/main/java/datadog/trace/api Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,13 @@ static void calculate() {
102
102
private ProcessTags () {}
103
103
104
104
// need to be synchronized on writing. As optimization, it does not need to be sync on read.
105
- public static synchronized void addTag (String key , String value ) {
105
+ public static void addTag (String key , String value ) {
106
106
if (enabled ) {
107
- Lazy .TAGS .put (key , value );
108
- Lazy .serializedForm = null ;
109
- Lazy .listForm = null ;
107
+ synchronized (Lazy .TAGS ) {
108
+ Lazy .TAGS .put (key , value );
109
+ Lazy .serializedForm = null ;
110
+ Lazy .listForm = null ;
111
+ }
110
112
}
111
113
}
112
114
@@ -136,15 +138,19 @@ public static UTF8BytesString getTagsForSerialization() {
136
138
137
139
/** Visible for testing. */
138
140
static void empty () {
139
- Lazy .TAGS .clear ();
140
- Lazy .serializedForm = null ;
141
- Lazy .listForm = null ;
141
+ synchronized (Lazy .TAGS ) {
142
+ Lazy .TAGS .clear ();
143
+ Lazy .serializedForm = null ;
144
+ Lazy .listForm = null ;
145
+ }
142
146
}
143
147
144
148
/** Visible for testing. */
145
149
static void reset () {
146
- empty ();
147
- enabled = Config .get ().isExperimentalPropagateProcessTagsEnabled ();
148
- Lazy .TAGS .putAll (Lazy .loadTags ());
150
+ synchronized (Lazy .TAGS ) {
151
+ empty ();
152
+ enabled = Config .get ().isExperimentalPropagateProcessTagsEnabled ();
153
+ Lazy .TAGS .putAll (Lazy .loadTags ());
154
+ }
149
155
}
150
156
}
You can’t perform that action at this time.
0 commit comments