zuston commented on code in PR #811:
URL: https://github.com/apache/incubator-uniffle/pull/811#discussion_r1166207575


##########
client-spark/common/src/main/java/org/apache/spark/shuffle/writer/WriterBuffer.java:
##########
@@ -26,70 +29,70 @@
 public class WriterBuffer {
 
   private static final Logger LOG = 
LoggerFactory.getLogger(WriterBuffer.class);
-  private long copyTime = 0;
-  private byte[] buffer;
-  private int bufferSize;
-  private int nextOffset = 0;
+  private AtomicLong copyTime = new AtomicLong(0);
+  private AtomicReference<byte[]> buffer = new AtomicReference<>();
+  private final AtomicInteger bufferSize;
+  private AtomicInteger nextOffset = new AtomicInteger(0);
   private List<WrappedBuffer> buffers = Lists.newArrayList();
-  private int dataLength = 0;
-  private int memoryUsed = 0;
+  private AtomicInteger dataLength = new AtomicInteger();
+  private AtomicInteger memoryUsed = new AtomicInteger();

Review Comment:
   Absolutely not. The `addRecord` and `getData` will be accessed by 2 threads.



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

To unsubscribe, e-mail: [email protected]

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


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

Reply via email to