lordcheng10 commented on a change in pull request #14970:
URL: https://github.com/apache/pulsar/pull/14970#discussion_r840189904



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java
##########
@@ -163,12 +163,17 @@ protected boolean isConsumersExceededOnSubscription() {
         return isConsumersExceededOnSubscription(topic, consumerList.size());
     }
 
+    private void removeAllConsumer(Consumer consumer){
+        while(consumerList.remove(consumer)){
+        }
+    }
+    
     @Override
     public synchronized void removeConsumer(Consumer consumer) throws 
BrokerServiceException {
         // decrement unack-message count for removed consumer
         addUnAckedMessages(-consumer.getUnackedMessages());
         if (consumerSet.removeAll(consumer) == 1) {
-            consumerList.remove(consumer);
+            removeAllConsumer(consumer);

Review comment:
       Fixed:
   1.do a check in addConsumer;
   2.use removeIf;
   
   PTAL,thanks! @lhotari 




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