HADOOP-8118. In metrics2.util.MBeans, change log level to trace for the stack trace of InstanceAlreadyExistsException.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1295240 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2012-02-29 19:57:43 +00:00
parent 28de3628f5
commit 2249e004d0
2 changed files with 13 additions and 1 deletions

View File

@ -160,6 +160,9 @@ Release 0.23.3 - UNRELEASED
HADOOP-8098. KerberosAuthenticatorHandler should use _HOST replacement to
resolve principal name (tucu)
HADOOP-8118. In metrics2.util.MBeans, change log level to trace for the
stack trace of InstanceAlreadyExistsException. (szetszwo)
OPTIMIZATIONS
BUG FIXES

View File

@ -18,6 +18,8 @@
package org.apache.hadoop.metrics2.util;
import java.lang.management.ManagementFactory;
import javax.management.InstanceAlreadyExistsException;
import javax.management.MBeanServer;
import javax.management.ObjectName;
@ -55,8 +57,15 @@ static public ObjectName register(String serviceName, String nameName,
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("Error registering "+ name, e);
LOG.warn("Failed to register MBean \""+ name + "\"", e);
}
return null;
}