Browse Source

YARN-2398. TestResourceTrackerOnHA crashes. Contributed by Ajith S.

(cherry picked from commit 666ad0b67b9162860fccddbd1d89c806c70b60ef)
Rohith Sharma K S 9 năm trước cách đây
mục cha
commit
05b384271c

+ 2 - 2
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/ProtocolHATestBase.java

@@ -328,7 +328,7 @@ public abstract class ProtocolHATestBase extends ClientBaseWithFixes {
     private boolean waittingForFailOver() {
       int maximumWaittingTime = 50;
       int count = 0;
-      while (!failoverTriggered.get() && count >= maximumWaittingTime) {
+      while (!failoverTriggered.get() && count <= maximumWaittingTime) {
         try {
           Thread.sleep(100);
         } catch (InterruptedException e) {
@@ -336,7 +336,7 @@ public abstract class ProtocolHATestBase extends ClientBaseWithFixes {
         }
         count++;
       }
-      if (count >= maximumWaittingTime) {
+      if (count >= maximumWaittingTime && failoverThread != null) {
         return false;
       }
       try {