lhotari commented on a change in pull request #10180:
URL: https://github.com/apache/pulsar/pull/10180#discussion_r610772740



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java
##########
@@ -184,7 +184,7 @@ public synchronized void removeConsumer(Consumer consumer) 
throws BrokerServiceE
                     messagesToRedeliver.add(ledgerId, entryId);
                     redeliveryTracker.addIfAbsent(PositionImpl.get(ledgerId, 
entryId));
                 });
-                totalAvailablePermits -= consumer.getAvailablePermits();
+                TOTAL_AVAILABLE_PERMITS_UPDATER.addAndGet(this, 
-consumer.getAvailablePermits());

Review comment:
       yes you are right, it seems that all updates are already happening 
withing `synchronized` methods. It seems that the case is similar in 
`NonPersistentDispatcherMultipleConsumers` where the 
`TOTAL_AVAILABLE_PERMITS_UPDATER` is currently used.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to