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_r283267267
 
 

 ##########
 File path: 
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java
 ##########
 @@ -395,19 +425,18 @@ private static void flushAndWait(final Channel channel, 
final ChannelPromise pro
       }
    }
 
-   private ChannelFuture writeBatch(final ByteBuf bytes, final int 
readableBytes, final ChannelPromise promise) {
+   private ChannelFuture writeBatch(final ByteBuf bytes, Object fileObject, 
final int readableBytes, final ChannelPromise promise) {
       final int batchBufferSize = batchBufferSize(channel, 
this.writeBufferHighWaterMark);
       final int nextBatchSize = batchBufferSize + readableBytes;
       if (nextBatchSize > batchLimit) {
          //request to flush before writing, to create the chance to make the 
channel writable again
          channel.flush();
-         //let netty use its write batching ability
-         return channel.write(bytes, promise);
-      } else if (nextBatchSize == batchLimit) {
-         return channel.writeAndFlush(bytes, promise);
+      }
+      if (fileObject == null) {
+         return nextBatchSize == batchLimit ? channel.writeAndFlush(bytes, 
promise) : channel.write(bytes, promise);
       } else {
-         //let netty use its write batching ability
-         return channel.write(bytes, promise);
+         channel.write(bytes);
 
 Review comment:
   No idea, depends..if the first one will fail and the second one succeed is 
not good...Take a look if is possible to create a composed future or (even 
better)  a single object that encapsulate both the things we want to write in 
sequence as a whole

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