wy96f 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_r283246012
##########
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:
Emm, i think we just need ChannelFuture of the last write(i.e. the file
transfer here)?
----------------------------------------------------------------
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