ayushtkn commented on a change in pull request #2693:
URL: https://github.com/apache/ozone/pull/2693#discussion_r732361413



##########
File path: 
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/StateContext.java
##########
@@ -616,16 +618,19 @@ public void execute(ExecutorService service, long time, 
TimeUnit unit)
       }
 
       if (!isThreadPoolAvailable(service)) {
-        long count = threadPoolNotAvailableCount.getAndIncrement();
-        if (count % getLogWarnInterval(conf) == 0) {
-          LOG.warn("No available thread in pool for past {} seconds.",
-              unit.toSeconds(time) * (count + 1));
+        long count = threadPoolNotAvailableCount.incrementAndGet();
+        long unavailableTime =
+            System.currentTimeMillis() - lastHeartbeatSent.get();
+        if (unavailableTime > time && count % getLogWarnInterval(conf) == 0) {
+          LOG.warn("No available thread in pool for the past {} seconds " +
+              "and {} times.", unit.toSeconds(unavailableTime), count);
         }
         return;
       }
-
+      
       threadPoolNotAvailableCount.set(0);
       task.execute(service);
+      lastHeartbeatSent.set(System.currentTimeMillis());

Review comment:
       I think that is to be used if we want to calculate difference in times. 
The first cut info I got is from the javaoc
   
https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Time.java#L51
   
   In hadoop they changed everywhere- 
https://issues.apache.org/jira/browse/HDFS-6841
   
   Will try to find some more descriptive doc & share




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to