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 58F429330 for ; Sun, 18 Mar 2012 06:33:23 +0000 (UTC) Received: (qmail 91517 invoked by uid 500); 18 Mar 2012 06:33:23 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 90978 invoked by uid 500); 18 Mar 2012 06:33:18 -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 90946 invoked by uid 99); 18 Mar 2012 06:33:17 -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 06:33:17 +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 06:33:15 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 50D5D25FC6 for ; Sun, 18 Mar 2012 06:32:54 +0000 (UTC) Date: Sun, 18 Mar 2012 06:32:54 +0000 (UTC) From: "Uma Maheswara Rao G (Updated) (JIRA)" To: common-issues@hadoop.apache.org Message-ID: <492143351.29243.1332052374346.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1523541705.23223.1331880233779.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Updated] (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:all-tabpanel ] Uma Maheswara Rao G updated HADOOP-8177: ---------------------------------------- Resolution: Fixed Fix Version/s: 0.24.0 Hadoop Flags: Reviewed Status: Resolved (was: Patch Available) I have committed this to trunk. Thanks Deva. > 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 > Fix For: 0.24.0 > > 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