zuston commented on code in PR #811:
URL: https://github.com/apache/incubator-uniffle/pull/811#discussion_r1166208103
##########
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:
Once `getData` is invoked, the `writeBuffer` should be changed to read-only.
This `semantic` is not shown in this part.
--
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]