Bläddra i källkod

HADOOP-11271. Use Time.monotonicNow() in Shell.java instead of Time.now() (Contributed by Vinayakumar B)

Vinayakumar B 10 år sedan
förälder
incheckning
8e9502e05d

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -397,6 +397,9 @@ Release 2.7.0 - UNRELEASED
 
     HADOOP-11269. Add java 8 profile for hadoop-annotations. (Li Lu via wheat9)
 
+    HADOOP-11271. Use Time.monotonicNow() in Shell.java instead of Time.now()
+    (vinayakumarb)
+
 Release 2.6.0 - UNRELEASED
 
   INCOMPATIBLE CHANGES

+ 2 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java

@@ -449,7 +449,7 @@ abstract public class Shell {
 
   /** check to see if a command needs to be executed and execute if needed */
   protected void run() throws IOException {
-    if (lastTime + interval > Time.now())
+    if (lastTime + interval > Time.monotonicNow())
       return;
     exitCode = 0; // reset for next run
     runCommand();
@@ -578,7 +578,7 @@ abstract public class Shell {
         LOG.warn("Error while closing the error stream", ioe);
       }
       process.destroy();
-      lastTime = Time.now();
+      lastTime = Time.monotonicNow();
     }
   }