소스 검색

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

Jason Lowe 8 년 전
부모
커밋
df180259b0
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java

+ 2 - 2
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();
     }