BewareMyPower opened a new pull request, #22285:
URL: https://github.com/apache/pulsar/pull/22285

   ### Motivation
   
   The modifications on
   `AbstractDispatcherSingleActiveConsumer#activeConsumer` only happen on 
`pickAndScheduleActiveConsumer`, which is only called in `addConsumer` and 
`removeConsumer`. However, both `addConsumer` and `removeConsumer` are 
synchronized methods so that we don't have to perform an atomic operation on 
`activeConsumer`.
   
   The composite operations on `activeConsumer` also happen on synchronized 
methods like `disconnectActiveConsumers`. The only access to `activeConsumer` 
that is not synchronized is the read on `activeConsumer` like 
`getActiveConsumer()` and `isConsumerConnected()`.
   
   ### Modifications
   
   Remove the `ACTIVE_CONSUMER_UPDATER` and note some methods are not thread 
safe or there is no need to make them thread safe.
   
   Besides, since `pickAndScheduleActiveConsumer` is never called concurrently, 
we don't need a double-checked locking on `readOnActiveConsumerTask`. Instead, 
just synchronize the modification in the scheduled task.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository:


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