HADOOP-8177. MBeans shouldn't try to register when it fails to create MBeanName. (Contributed by Devaraj K).
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1302067 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0ac5e89419
commit
a019a6f7c9
|
@ -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)
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue