HADOOP-14669. GenericTestUtils.waitFor should use monotonic time. Contributed 
by Daniel Templeton


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/df180259
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/df180259
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/df180259

Branch: refs/heads/HDFS-7240
Commit: df180259b0cc3660e199e85447c7193bee51751c
Parents: 2843c68
Author: Jason Lowe <jl...@yahoo-inc.com>
Authored: Wed Jul 19 09:41:22 2017 -0500
Committer: Jason Lowe <jl...@yahoo-inc.com>
Committed: Wed Jul 19 09:41:22 2017 -0500

----------------------------------------------------------------------
 .../src/test/java/org/apache/hadoop/test/GenericTestUtils.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/df180259/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
----------------------------------------------------------------------
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
index 38a0c6c..9291bb0 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
@@ -356,10 +356,10 @@ public abstract class GenericTestUtils {
     Preconditions.checkArgument(waitForMillis >= checkEveryMillis,
         ERROR_INVALID_ARGUMENT);
 
-    long st = Time.now();
+    long st = Time.monotonicNow();
     boolean result = check.get();
 
-    while (!result && (Time.now() - st < waitForMillis)) {
+    while (!result && (Time.monotonicNow() - st < waitForMillis)) {
       Thread.sleep(checkEveryMillis);
       result = check.get();
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to