runzhiwang commented on a change in pull request #243:
URL: https://github.com/apache/incubator-ratis/pull/243#discussion_r514930109



##########
File path: 
ratis-test/src/test/java/org/apache/ratis/datastream/TestDataStreamBase.java
##########
@@ -65,8 +84,7 @@ public int write(ByteBuffer src) {
         }
         final int remaining = src.remaining();
         for(; src.remaining() > 0; ) {
-          Assert.assertEquals(pos2byte(byteWritten), src.get());
-          byteWritten += 1;
+          Assert.assertEquals(pos2byte(byteWritten.getAndIncrement()), 
src.get());

Review comment:
       Sorry, why we use AtomicInteger for byteWritten? will `write(ByteBuffer 
src)` be called by multi-thread ? If so, can we use `synchronized 
write(ByteBuffer src)` ?




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


Reply via email to