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
This commit is contained in:
Jason Darrell Lowe 2013-04-27 04:11:23 +00:00
parent 75b4231a8c
commit fc45cbf8df
2 changed files with 8 additions and 2 deletions

View File

@ -644,6 +644,9 @@ Release 2.0.5-beta - UNRELEASED
HADOOP-9473. Typo in FileUtil copy() method. (Glen Mazza via suresh) 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 Release 2.0.4-alpha - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES
@ -1657,6 +1660,9 @@ Release 0.23.8 - UNRELEASED
HADOOP-9469. mapreduce/yarn source jars not included in dist tarball HADOOP-9469. mapreduce/yarn source jars not included in dist tarball
(Robert Parker via tgraves) (Robert Parker via tgraves)
HADOOP-9504. MetricsDynamicMBeanBase has concurrency issues in
createMBeanInfo (Liang Xie via jlowe)
Release 0.23.7 - UNRELEASED Release 0.23.7 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -18,9 +18,9 @@
package org.apache.hadoop.metrics.util; package org.apache.hadoop.metrics.util;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.management.Attribute; import javax.management.Attribute;
import javax.management.AttributeList; import javax.management.AttributeList;
@ -69,6 +69,7 @@ public abstract class MetricsDynamicMBeanBase implements DynamicMBean {
protected MetricsDynamicMBeanBase(final MetricsRegistry mr, final String aMBeanDescription) { protected MetricsDynamicMBeanBase(final MetricsRegistry mr, final String aMBeanDescription) {
metricsRegistry = mr; metricsRegistry = mr;
mbeanDescription = aMBeanDescription; mbeanDescription = aMBeanDescription;
metricsRateAttributeMod = new ConcurrentHashMap<String, MetricsBase>();
createMBeanInfo(); createMBeanInfo();
} }
@ -78,7 +79,6 @@ private void updateMbeanInfoIfMetricsListChanged() {
} }
private void createMBeanInfo() { private void createMBeanInfo() {
metricsRateAttributeMod = new HashMap<String, MetricsBase>();
boolean needsMinMaxResetOperation = false; boolean needsMinMaxResetOperation = false;
List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>(); List<MBeanAttributeInfo> attributesInfo = new ArrayList<MBeanAttributeInfo>();
MBeanOperationInfo[] operationsInfo = null; MBeanOperationInfo[] operationsInfo = null;