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/03/18 04:39:31 UTC

[GitHub] [pulsar] Jason918 commented on a change in pull request #14566: [client] Optimize pause when creating sub consumers in multi-topic consumer

Jason918 commented on a change in pull request #14566:
URL: https://github.com/apache/pulsar/pull/14566#discussion_r829690543



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java
##########
@@ -1036,6 +1037,8 @@ private void doSubscribeTopicPartitions(Schema<T> schema,
                         synchronized (pauseMutex) {
                             if (paused) {

Review comment:
       > I think maybe we can remove the `synchronized (pauseMutex)` too
   
   Not really, if the pause state changes between after 1038 and before line 1043, pause state of this newConsumer will be wrong.
   
   > If we create a new consumer with `pause` state, we don't need to pause it again.
   
   Yes, but current implementation of `newConsumer.pause()` and `newConsumer.resume()` is idempotent and handles the case when it's called repeatedly. I think the code is more clear this way. WDYT? @aloyszhang 




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