You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/08/22 00:54:46 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #3287: Add cached writer.

wu-sheng commented on a change in pull request #3287: Add cached writer.
URL: https://github.com/apache/skywalking/pull/3287#discussion_r316459262
 
 

 ##########
 File path: apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/logging/core/WriterFactory.java
 ##########
 @@ -25,23 +25,37 @@
 import org.apache.skywalking.apm.agent.core.conf.SnifferConfigInitializer;
 import org.apache.skywalking.apm.util.StringUtil;
 
+/**
+ * @author Alan Lau
+ */
 public class WriterFactory {
+
+    private static volatile IWriter WRITER;
 
 Review comment:
   Most application has thread pool, such as Tomcat. Even cache mechanism makes the check method invoked more than once, it is harmless. But if you add `volatile `, you will force every single access to real memory rather than cache. I am seeing this as an unexpected cost.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services