wu-sheng commented on a change in pull request #4363: Fix non-atomic operations 
on volatile variables
URL: https://github.com/apache/skywalking/pull/4363#discussion_r379748997
 
 

 ##########
 File path: 
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/GRPCChannelManager.java
 ##########
 @@ -48,7 +49,7 @@
     private final List<GRPCChannelListener> listeners = 
Collections.synchronizedList(new LinkedList<>());
     private volatile List<String> grpcServers;
     private volatile int selectedIdx = -1;
-    private volatile int reconnectCount = 0;
+    private AtomicInteger reconnectCount = new AtomicInteger(0);
 
 Review comment:
   Why AtomicInteger?

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


With regards,
Apache Git Services

Reply via email to