You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/04 15:12:02 UTC

[GitHub] [pulsar] eolivelli commented on a diff in pull request #16304: [fix][broker] Do not use IO thread for consumerFlow in Shared subscription

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


##########
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:
   this is required, because we are accessing shared variables



-- 
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: commits-unsubscribe@pulsar.apache.org

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