hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Devaraj K (Updated) (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HADOOP-8177) MBeans shouldn't try to register when it fails to create MBeanName
Date Fri, 16 Mar 2012 10:07:42 GMT

     [ https://issues.apache.org/jira/browse/HADOOP-8177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Devaraj K updated HADOOP-8177:
------------------------------

    Attachment: HADOOP-8177.patch
    
> 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
>         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

        

Mime
View raw message