horizonzy commented on code in PR #3365:
URL: https://github.com/apache/bookkeeper/pull/3365#discussion_r929552306
##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManager.java:
##########
@@ -402,6 +402,7 @@ public void registerLedgerMetadataListener(long ledgerId,
LedgerMetadataListener
}
}
synchronized (listenerSet) {
+ listenerSet = listeners.computeIfAbsent(ledgerId, k -> new
HashSet<>());
Review Comment:
It will reduce too many concurrency. If we listen too many zk nodes, when
received event, also synchronized, it maybe make program slow.
see
https://github.com/apache/bookkeeper/blob/ded05aa2218f1e98c650070e9d0152213c4d09fe/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManager.java#L125.
--
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]