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

svn merge --ignore-ancestry -c 1399066 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1399067 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2012-10-17 01:29:12 +00:00
parent 6b11a5e94a
commit 32d3e4e9f5
3 changed files with 12 additions and 1 deletions

View File

@ -130,6 +130,9 @@ Release 0.23.5 - UNRELEASED
YARN-161. Fix multiple compiler warnings for unchecked operations in YARN YARN-161. Fix multiple compiler warnings for unchecked operations in YARN
common. (Chris Nauroth via vinodkv) 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 OPTIMIZATIONS
BUG FIXES 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.DefaultMetricsSystem;
import org.apache.hadoop.metrics2.lib.MetricsRegistry; import org.apache.hadoop.metrics2.lib.MetricsRegistry;
import org.apache.hadoop.metrics2.lib.MutableGaugeInt; import org.apache.hadoop.metrics2.lib.MutableGaugeInt;
import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeEventType; import com.google.common.annotations.VisibleForTesting;
@InterfaceAudience.Private @InterfaceAudience.Private
@Metrics(context="yarn") @Metrics(context="yarn")
@ -71,6 +71,12 @@ public class ClusterMetrics {
ms.register("ClusterMetrics", "Metrics for the Yarn Cluster", INSTANCE); ms.register("ClusterMetrics", "Metrics for the Yarn Cluster", INSTANCE);
} }
} }
@VisibleForTesting
synchronized static void destroy() {
isInitialized.set(false);
INSTANCE = null;
}
//Active Nodemanagers //Active Nodemanagers
public int getNumActiveNMs() { public int getNumActiveNMs() {
@ -136,4 +142,5 @@ public class ClusterMetrics {
public void decrNumActiveNodes() { public void decrNumActiveNodes() {
numActiveNMs.decr(); numActiveNMs.decr();
} }
} }

View File

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