Skip to content

Commit

Permalink
make sure msg can be recycled
Browse files Browse the repository at this point in the history
  • Loading branch information
aloyszhang committed Jun 28, 2021
1 parent d4220f1 commit d45e1a7
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -276,11 +276,16 @@ public static long getEntryTimestamp( ByteBuf headersAndPayloadWithBrokerEntryMe
if (brokerEntryMetadata != null && brokerEntryMetadata.hasBrokerTimestamp()) {
return brokerEntryMetadata.getBrokerTimestamp();
}
// otherwise get the publish_time
// otherwise get the publish_time,
long entryTimestamp;
MessageImpl<byte[]> msg = (MessageImpl<byte[]>) RECYCLER.get();
Commands.parseMessageMetadata(headersAndPayloadWithBrokerEntryMetadata, msg.msgMetadata);
long entryTimestamp = msg.getPublishTime();
msg.recycle();
try {
Commands.parseMessageMetadata(headersAndPayloadWithBrokerEntryMetadata, msg.msgMetadata);
entryTimestamp = msg.getPublishTime();
} finally {
// make sure msg can be recycled
msg.recycle();
}
return entryTimestamp;
}

Expand Down

0 comments on commit d45e1a7

Please sign in to comment.