franz1981 commented on a change in pull request #3048: ARTEMIS-1975 Fixing 
LargeMessage encoding for replication
URL: https://github.com/apache/activemq-artemis/pull/3048#discussion_r397945983
 
 

 ##########
 File path: 
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPLargeMessagePersister.java
 ##########
 @@ -96,10 +91,11 @@ public void encode(ActiveMQBuffer buffer, Message record) {
          properties.encode(buffer.byteBuf());
       }
 
-      ByteBuf savedEncodeBuffer = getSavedEncodeBuffer(record);
+      ByteBuf savedEncodeBuffer = msgEncode.getSavedEncodeBuffer();
       buffer.writeBytes(savedEncodeBuffer, 0, savedEncodeBuffer.writerIndex());
-      savedEncodeBuffer.release();
-      msgEncode.temporaryBuffer = null;
+      msgEncode.releaseEncodedBuffer();
+      msgEncode.releaseEncodedBuffer(); // We need two releases here, one for 
the retain when the savedEncodeBuffer was called
 
 Review comment:
   Just to write here an example: 
https://netty.io/4.1/api/io/netty/buffer/ByteBuf.html#readRetainedSlice-int-

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to