wade wu created KAFKA-6722:
------------------------------
Summary: SensorAccess.getOrCreate should be more efficient
Key: KAFKA-6722
URL: https://issues.apache.org/jira/browse/KAFKA-6722
Project: Kafka
Issue Type: Improvement
Reporter: wade wu
The lock/unlock of read lock in getOrCreate() is not necessary, or it should be
refactored. For each request from Producer, this read lock lock/unlock is
called and lock/unlock, it is costing the time. It can be easily fixed using
code below, and it is still thread safe:
var sensor: Sensor = metrics.getSensor(sensorName)
if (sensor == null) {
lock.writeLock().lock()
try{
........
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)