HeartSaVioR commented on a change in pull request #27071: [SPARK-30406] 
OneForOneStreamManager ensure that compound operations on shared variables are 
atomic
URL: https://github.com/apache/spark/pull/27071#discussion_r362404246
 
 

 ##########
 File path: 
common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java
 ##########
 @@ -57,7 +57,7 @@
     int curChunk = 0;
 
     // Used to keep track of the number of chunks being transferred and not 
finished yet.
-    volatile long chunksBeingTransferred = 0L;
+    volatile AtomicLong chunksBeingTransferred = new AtomicLong(0L);
 
 Review comment:
   No longer needed to be `volatile`, as well as can add `final` to make sure 
we don't change assignment.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to