Technoboy- commented on code in PR #23795:
URL: https://github.com/apache/pulsar/pull/23795#discussion_r1900495658
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumersClassic.java:
##########
@@ -560,8 +593,11 @@ public boolean hasSameKeySharedPolicy(KeySharedMeta ksm) {
&& ksm.isAllowOutOfOrderDelivery() ==
this.allowOutOfOrderDelivery);
}
- public LinkedHashMap<Consumer, Position> getRecentlyJoinedConsumers() {
- return recentlyJoinedConsumers;
+ public synchronized LinkedHashMap<Consumer, Position>
getRecentlyJoinedConsumers() {
+ if (recentlyJoinedConsumers == null) {
+ return null;
+ }
+ return new LinkedHashMap<>(recentlyJoinedConsumers);
Review Comment:
why need to recreate a new `LinkedHashMap`
--
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]