315157973 commented on PR #19560:
URL: https://github.com/apache/pulsar/pull/19560#issuecomment-1439289934

   > I see brokerAvgResourceUsage is not a thread safe container, are all 
accesses to brokerAvgResourceUsage in the same thread?
   
   There is a single-threaded scheduler in Leader Broker to execute him, so it 
is thread-safe
   
   > What about using a AtomicReference instead of using a concurrent map?
   
   What we need to ensure is the thread safety of activeBrokers, because there 
will be two threads operating it at the same time. We need to ensure the 
atomicity of its `read` and `clear`
   The operation of `brokerAvgResourceUsage` is thread-safe and runs in a 
single thread
   
   


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