From fc45cbf8dfcd73d96a588d4a454cc405345b140f Mon Sep 17 00:00:00 2001 From: Jason Darrell Lowe Date: Sat, 27 Apr 2013 04:11:23 +0000 Subject: [PATCH] HADOOP-9504. MetricsDynamicMBeanBase has concurrency issues in createMBeanInfo. Contributed by Liang Xie git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1476487 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/CHANGES.txt | 6 ++++++ .../apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 47968d336ce..6fc6dcbc17a 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -644,6 +644,9 @@ Release 2.0.5-beta - UNRELEASED HADOOP-9473. Typo in FileUtil copy() method. (Glen Mazza via suresh) + HADOOP-9504. MetricsDynamicMBeanBase has concurrency issues in + createMBeanInfo (Liang Xie via jlowe) + Release 2.0.4-alpha - UNRELEASED INCOMPATIBLE CHANGES @@ -1657,6 +1660,9 @@ Release 0.23.8 - UNRELEASED HADOOP-9469. mapreduce/yarn source jars not included in dist tarball (Robert Parker via tgraves) + HADOOP-9504. MetricsDynamicMBeanBase has concurrency issues in + createMBeanInfo (Liang Xie via jlowe) + Release 0.23.7 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java index ea663a45b37..57014d5781b 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/util/MetricsDynamicMBeanBase.java @@ -18,9 +18,9 @@ package org.apache.hadoop.metrics.util; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import javax.management.Attribute; import javax.management.AttributeList; @@ -69,6 +69,7 @@ public abstract class MetricsDynamicMBeanBase implements DynamicMBean { protected MetricsDynamicMBeanBase(final MetricsRegistry mr, final String aMBeanDescription) { metricsRegistry = mr; mbeanDescription = aMBeanDescription; + metricsRateAttributeMod = new ConcurrentHashMap(); createMBeanInfo(); } @@ -78,7 +79,6 @@ public abstract class MetricsDynamicMBeanBase implements DynamicMBean { } private void createMBeanInfo() { - metricsRateAttributeMod = new HashMap(); boolean needsMinMaxResetOperation = false; List attributesInfo = new ArrayList(); MBeanOperationInfo[] operationsInfo = null;