Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E4CFD91AC for ; Sun, 18 Mar 2012 05:02:27 +0000 (UTC) Received: (qmail 42197 invoked by uid 500); 18 Mar 2012 05:02:27 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 42163 invoked by uid 500); 18 Mar 2012 05:02:27 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 42131 invoked by uid 99); 18 Mar 2012 05:02:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Mar 2012 05:02:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 Mar 2012 05:02:24 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 0558E25B7B for ; Sun, 18 Mar 2012 05:02:03 +0000 (UTC) Date: Sun, 18 Mar 2012 05:02:03 +0000 (UTC) From: "Uma Maheswara Rao G (Commented) (JIRA)" To: common-issues@hadoop.apache.org Message-ID: <1529860930.29106.1332046923244.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1523541705.23223.1331880233779.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HADOOP-8177) MBeans shouldn't try to register when it fails to create MBeanName MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HADOOP-8177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13232168#comment-13232168 ] Uma Maheswara Rao G commented on HADOOP-8177: --------------------------------------------- Already filed JIRA for test failure. HADOOP-8110. Will commit this patch momentarily. > 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