[ https://issues.apache.org/jira/browse/HADOOP-8177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13232181#comment-13232181 ]
Hudson commented on HADOOP-8177: -------------------------------- Integrated in Hadoop-Hdfs-trunk-Commit #1972 (See [https://builds.apache.org/job/Hadoop-Hdfs-trunk-Commit/1972/]) HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName. (Contributed by Devaraj K). (Revision 1302067) Result = SUCCESS umamahesh : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1302067 Files : * /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 > MBeans shouldn't try to register when it fails to create MBeanName > ------------------------------------------------------------------ > > Key: HADOOP-8177 > URL: https://issues.apache.org/jira/browse/HADOOP-8177 > Project: Hadoop Common > Issue Type: Bug > Components: metrics > Affects Versions: 0.24.0 > Reporter: Devaraj K > Assignee: Devaraj K > Priority: Minor > Attachments: HADOOP-8177.patch > > > {code:title=MBeans.java|borderStyle=solid} > static public ObjectName register(String serviceName, String nameName, > 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."); > } > } catch (Exception e) { > LOG.warn("Failed to register MBean \""+ name + "\"", e); > } > return null; > } > static private ObjectName getMBeanName(String serviceName, String nameName) > { > ObjectName name = null; > String nameStr = "Hadoop:service="+ serviceName +",name="+ nameName; > try { > name = DefaultMetricsSystem.newMBeanName(nameStr); > } catch (Exception e) { > LOG.warn("Error creating MBean object name: "+ nameStr, e); > } > return name; > } > {code} > In getMBeanName() if DefaultMetricsSystem.newMBeanName(nameStr); fails with > some reason like mbean already exists, getMBeanName() logs the exception and > returns null and mbs.registerMBean(theMbean, name) in register() tries to > register with null and throws exception with the message 'Failed to register > MBean "null"'. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira