davidradl commented on code in PR #26761:
URL: https://github.com/apache/flink/pull/26761#discussion_r2192396019


##########
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/InternalSourceReaderMetricGroup.java:
##########
@@ -144,11 +144,20 @@ public void updateMaxDesiredWatermark(long 
currentMaxDesiredWatermark) {
     }
 
     boolean isIdling() {
+        return isIdling(idleStartTime);
+    }
+
+    private boolean isIdling(long idleStartTime) {
         return idleStartTime != ACTIVE;
     }
 
     long getIdleTime() {
-        return isIdling() ? this.clock.absoluteTimeMillis() - idleStartTime : 
0;
+        // this class is not thread-safe, use the local variable to get a 
snapshot value.
+        long currentIdleStartTime = idleStartTime;

Review Comment:
   I am curious about whether you think we need the high number set at all. 
Could we set to 0 for active in line with the way the getter returns?  
   
   The code would be simpler if we can remove the internal high number.  
    
   



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