hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umamah...@apache.org
Subject svn commit: r1302067 - in /hadoop/common/trunk/hadoop-common-project/hadoop-common: CHANGES.txt src/main/java/org/apache/hadoop/metrics2/util/MBeans.java
Date Sun, 18 Mar 2012 05:54:33 GMT
Author: umamahesh
Date: Sun Mar 18 05:54:33 2012
New Revision: 1302067

URL: http://svn.apache.org/viewvc?rev=1302067&view=rev
Log:
HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName. (Contributed
by Devaraj K).

Modified:
    hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MBeans.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1302067&r1=1302066&r2=1302067&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt Sun Mar 18 05:54:33
2012
@@ -54,6 +54,9 @@ Trunk (unreleased changes)
 
   BUG FIXES
 
+    HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName.
+    (Devaraj K via umamahesh)
+
     HADOOP-7900. LocalDirAllocator confChanged() accesses conf.get() twice
     (Ravi Gummadi via Uma Maheswara Rao G)
 

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MBeans.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MBeans.java?rev=1302067&r1=1302066&r2=1302067&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MBeans.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/util/MBeans.java
Sun Mar 18 05:54:33 2012
@@ -53,19 +53,21 @@ public class MBeans {
                                     Object theMbean) {
     final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
     ObjectName name = getMBeanName(serviceName, nameName);
-    try {
-      mbs.registerMBean(theMbean, name);
-      LOG.debug("Registered "+ name);
-      return name;
-    } catch (InstanceAlreadyExistsException iaee) {
-      if (LOG.isTraceEnabled()) {
-        LOG.trace("Failed to register MBean \""+ name + "\"", iaee);
-      } else {
-        LOG.warn("Failed to register MBean \""+ name
-            + "\": Instance already exists.");
+    if (name != null) {
+      try {
+        mbs.registerMBean(theMbean, name);
+        LOG.debug("Registered " + name);
+        return name;
+      } catch (InstanceAlreadyExistsException iaee) {
+        if (LOG.isTraceEnabled()) {
+          LOG.trace("Failed to register MBean \"" + name + "\"", iaee);
+        } else {
+          LOG.warn("Failed to register MBean \"" + name
+              + "\": Instance already exists.");
+        }
+      } catch (Exception e) {
+        LOG.warn("Failed to register MBean \"" + name + "\"", e);
       }
-    } catch (Exception e) {
-      LOG.warn("Failed to register MBean \""+ name + "\"", e);
     }
     return null;
   }



Mime
View raw message