merlimat commented on code in PR #26019:
URL: https://github.com/apache/pulsar/pull/26019#discussion_r3408765879


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PendingAcksMap.java:
##########
@@ -160,7 +164,7 @@ public boolean addPendingAckIfAllowed(long ledgerId, long 
entryId, int remaining
     public long size() {
         try {
             readLock.lock();
-            return pendingAcks.values().stream().mapToInt(TreeMap::size).sum();
+            return size;

Review Comment:
   We could remove the read lock here if we make the size as `volatile` (and 
still update it while holding the lock).



-- 
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]

Reply via email to