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:
Uma Maheswara Rao G 2012-03-18 05:54:33 +00:00
parent 0ac5e89419
commit a019a6f7c9
2 changed files with 17 additions and 12 deletions

View File

@ -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)

View File

@ -53,6 +53,7 @@ static public ObjectName register(String serviceName, String nameName,
Object theMbean) {
final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = getMBeanName(serviceName, nameName);
if (name != null) {
try {
mbs.registerMBean(theMbean, name);
LOG.debug("Registered " + name);
@ -67,6 +68,7 @@ static public ObjectName register(String serviceName, String nameName,
} catch (Exception e) {
LOG.warn("Failed to register MBean \"" + name + "\"", e);
}
}
return null;
}