mdedetrich commented on code in PR #12281:
URL: https://github.com/apache/kafka/pull/12281#discussion_r937115822


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/metrics/RocksDBMetricsRecordingTrigger.java:
##########
@@ -32,12 +32,12 @@ public RocksDBMetricsRecordingTrigger(final Time time) {
 
     public void addMetricsRecorder(final RocksDBMetricsRecorder 
metricsRecorder) {
         final String metricsRecorderName = 
metricsRecorderName(metricsRecorder);
-        if (metricsRecordersToTrigger.containsKey(metricsRecorderName)) {
+        final RocksDBMetricsRecorder existingRocksDBMetricsRecorder = 
metricsRecordersToTrigger.putIfAbsent(metricsRecorderName, metricsRecorder);

Review Comment:
   I agree with @C0urante here, if the method isn't meant to be invoked in a 
concurrent situation then we should either revert to the original `containsKey` 
OR add a comment along the lines of "Currently this code isn't called in a 
concurrent situation"



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