franz1981 commented on a change in pull request #2666: ARTEMIS-2336 Use zero 
copy to replicate journal/page/large message file
URL: https://github.com/apache/activemq-artemis/pull/2666#discussion_r283218511
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationSyncFileMessage.java
 ##########
 @@ -197,6 +232,15 @@ public void decodeRest(final ActiveMQBuffer buffer) {
       }
    }
 
+   private void readFile(ByteBuffer buffer) {
+      try (FileInputStream fis = new FileInputStream(file); FileChannel 
channel = fis.getChannel()) {
+         channel.position(offset);
+         channel.read(buffer);
 
 Review comment:
   For this purpose 
https://docs.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html#read(java.nio.ByteBuffer,
 long) it more efficient. But is ok to open/close every time the FileChannel 
just to read a chunk of it?

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

Reply via email to