muse-dev[bot] commented on a change in pull request #6894:
URL: https://github.com/apache/skywalking/pull/6894#discussion_r626607585



##########
File path: 
apm-sniffer/optional-plugins/optional-spring-plugins/spring-mvc-annotation-naming-plugin/src/main/java/org/apache/skywalking/apm/plugin/spring/mvc/naming/SpringMVCEndpointNamingResolver.java
##########
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.apm.plugin.spring.mvc.naming;
+
+import org.apache.skywalking.apm.agent.core.boot.ServiceManager;
+import org.apache.skywalking.apm.agent.core.context.tag.AbstractTag;
+import org.apache.skywalking.apm.agent.core.context.tag.Tags;
+import org.apache.skywalking.apm.agent.core.context.util.TagValuePair;
+import org.apache.skywalking.apm.agent.core.naming.EndpointNameNamingResolver;
+import org.apache.skywalking.apm.agent.core.naming.EndpointNamingControl;
+import org.apache.skywalking.apm.agent.core.naming.SpanOutline;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+public class SpringMVCEndpointNamingResolver implements 
EndpointNameNamingResolver {
+    private static SpringMVCEndpointNamingResolver RESOLVER;
+
+    public synchronized static void bootstrap() {
+        if (RESOLVER != null) {
+            return;
+        }
+        RESOLVER = new SpringMVCEndpointNamingResolver();
+        
ServiceManager.INSTANCE.findService(EndpointNamingControl.class).addResolver(RESOLVER);
+    }
+
+    public static SpringMVCEndpointNamingResolver getResolver() {
+        return RESOLVER;

Review comment:
       *THREAD_SAFETY_VIOLATION:*  Read/Write race. Non-private method 
`SpringMVCEndpointNamingResolver.getResolver()` reads without synchronization 
from `naming.SpringMVCEndpointNamingResolver.RESOLVER`. Potentially races with 
write in method `SpringMVCEndpointNamingResolver.bootstrap()`.
    Reporting because another access to the same memory occurs on a background 
thread, although this access may not.
   (at-me [in a reply](https://docs.muse.dev/docs/talk-to-muse/) with `help` or 
`ignore`)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to