ctubbsii commented on a change in pull request #392: Fixes ACCUMULO-4832 
Initial log message for retries is debug, and ...
URL: https://github.com/apache/accumulo/pull/392#discussion_r170723208
 
 

 ##########
 File path: fate/src/main/java/org/apache/accumulo/fate/zookeeper/Retry.java
 ##########
 @@ -166,18 +166,26 @@ protected void sleep(long wait) throws 
InterruptedException {
   }
 
   public void logRetry(Logger log, String message, Throwable t) {
-    // log the first time, and then after every logInterval
-    if (lastRetryLog < 0 || (System.currentTimeMillis() - lastRetryLog) > 
logInterval) {
+    // log the first time as debug, and then after every logInterval as a 
warning
+    long now = System.currentTimeMillis();
+    if (lastRetryLog < 0) {
+      log.debug(getMessage(message));
+      lastRetryLog = now;
+    } else if ((now - lastRetryLog) > logInterval) {
       log.warn(getMessage(message), t);
-      lastRetryLog = System.currentTimeMillis();
+      lastRetryLog = now;
     }
   }
 
   public void logRetry(Logger log, String message) {
-    // log the first time, and then after every logInterval
-    if (lastRetryLog < 0 || (System.currentTimeMillis() - lastRetryLog) > 
logInterval) {
+    // log the first time as debug, and then after every logInterval as a 
warning
+    long now = System.currentTimeMillis();
 
 Review comment:
   I strongly recommend using `System.nanoTime()` for elapsed time. 
`System.currentTimeMillis()` is for clock time, which can go backwards and 
result in a surprising negative difference between the two values.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to