YARN-43. Fix TestResourceTrackerService to not depend on test order and thus pass on JDK7. Contributed by Thomas Graves.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1399066 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2012-10-17 01:24:50 +00:00
parent 402836479f
commit ab727f4966
3 changed files with 12 additions and 1 deletions

View File

@ -148,6 +148,9 @@ Release 0.23.5 - UNRELEASED
YARN-161. Fix multiple compiler warnings for unchecked operations in YARN
common. (Chris Nauroth via vinodkv)
YARN-43. Fix TestResourceTrackerService to not depend on test order and thus
pass on JDK7. (Thomas Graves via vinodkv)
OPTIMIZATIONS
BUG FIXES

View File

@ -30,7 +30,7 @@ import org.apache.hadoop.metrics2.annotation.Metrics;
import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableGaugeInt;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType;
import com.google.common.annotations.VisibleForTesting;
@InterfaceAudience.Private
@Metrics(context="yarn")
@ -72,6 +72,12 @@ public class ClusterMetrics {
}
}
@VisibleForTesting
synchronized static void destroy() {
isInitialized.set(false);
INSTANCE = null;
}
//Active Nodemanagers
public int getNumActiveNMs() {
return numActiveNMs.value();
@ -136,4 +142,5 @@ public class ClusterMetrics {
public void decrNumActiveNodes() {
numActiveNMs.decr();
}
}

View File

@ -414,6 +414,7 @@ public class TestResourceTrackerService {
if (hostFile != null && hostFile.exists()) {
hostFile.delete();
}
ClusterMetrics.destroy();
if (rm != null) {
rm.stop();
}