brandboat commented on code in PR #19828:
URL: https://github.com/apache/kafka/pull/19828#discussion_r2109362637


##########
metadata/src/main/java/org/apache/kafka/controller/metrics/QuorumControllerMetrics.java:
##########
@@ -267,7 +267,11 @@ public long newActiveControllers() {
     }
 
     public void updateBrokerContactTime(int brokerId) {
-        brokerContactTimesMs.putIfAbsent(brokerId, new 
AtomicLong(time.milliseconds()));
+        if (!brokerContactTimesMs.containsKey(brokerId)) {
+            brokerContactTimesMs.put(brokerId, new 
AtomicLong(time.milliseconds()));
+        } else {
+            brokerContactTimesMs.get(brokerId).set(time.milliseconds());
+        }

Review Comment:
   One small nitpick, although they are essentially the same thing.
   
   ```java
       AtomicLong contactTime = brokerContactTimesMs.computeIfAbsent(brokerId, 
k -> new AtomicLong());
       contactTime.set(time.milliseconds());
   ```



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