divijvaidya opened a new pull request, #12940:
URL: https://github.com/apache/kafka/pull/12940

   When we want to add a sensor to `Metrics.java`, we synchronize the entire 
method. However both, `sensors` and `childrenSensors` are concurrent hash maps 
and full method synchronization is not required. 
   
   This PR removes the method level synchronization and uses the properties of 
concurrent hash map to ensure thread safety. 
   
   The motivation of this change is code hygiene improvement and there is no 
known bottleneck by this lock contention.
   
   Behaviour after the change:
   - sensors with different names can be added to the `sensors` map 
concurrently (vs. earlier where only one could be added at a time)
   
   
   
   


-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to