BewareMyPower commented on code in PR #18729:
URL: https://github.com/apache/pulsar/pull/18729#discussion_r1040977330
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractBaseDispatcher.java:
##########
@@ -125,11 +128,15 @@ public int
filterEntriesForConsumer(Optional<MessageMetadata[]> optMetadataArray
}
ByteBuf metadataAndPayload = entry.getDataBuffer();
final int metadataIndex = i + startOffset;
- final MessageMetadata msgMetadata =
optMetadataArray.map(metadataArray -> metadataArray[metadataIndex])
- .orElseGet(() -> (entry instanceof EntryAndMetadata)
- ? ((EntryAndMetadata) entry).getMetadata()
- :
Commands.peekAndCopyMessageMetadata(metadataAndPayload,
subscription.toString(), -1)
- );
+
+ MessageMetadata msgMetadata;
+ if (metadataArray != null) {
+ msgMetadata = metadataArray[metadataIndex];
+ } else if (entry instanceof EntryAndMetadata entryAndMetadata) {
Review Comment:
+1. This PR could be cherry-picked to old releases, we should keep the code
compatible with JDK 8.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]