hangc0276 commented on code in PR #16304:
URL: https://github.com/apache/pulsar/pull/16304#discussion_r913091092


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherMultipleConsumers.java:
##########
@@ -205,7 +206,13 @@ public synchronized void removeConsumer(Consumer consumer) 
throws BrokerServiceE
     }
 
     @Override
-    public synchronized void consumerFlow(Consumer consumer, int 
additionalNumberOfMessages) {
+    public void consumerFlow(Consumer consumer, int 
additionalNumberOfMessages) {
+        
topic.getBrokerService().getTopicOrderedExecutor().executeOrdered(topic.getName(),
 SafeRun.safeRun(() -> {
+            internalConsumerFlow(consumer, additionalNumberOfMessages);
+        }));
+    }
+
+    private synchronized void internalConsumerFlow(Consumer consumer, int 
additionalNumberOfMessages) {

Review Comment:
   If we use the same thread to execute internalConsumerFlow in order, do we 
still need `synchronized`?



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