HADOOP-8027. Visiting /jmx on the daemon web interfaces may print unnecessary error in logs. Contributed by Aaron T. Myers.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1241303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-02-07 01:09:34 +00:00
parent 59d1f07d6c
commit 2d1406e9e7
2 changed files with 15 additions and 2 deletions

View File

@ -243,6 +243,9 @@ Release 0.23.1 - Unreleased
HADOOP-7470. Move up to Jackson 1.8.8. (Enis Soztutar via szetszwo) HADOOP-7470. Move up to Jackson 1.8.8. (Enis Soztutar via szetszwo)
HADOOP-8027. Visiting /jmx on the daemon web interfaces may print
unnecessary error in logs. (atm)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -34,6 +34,7 @@ import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException; import javax.management.MalformedObjectNameException;
import javax.management.ObjectName; import javax.management.ObjectName;
import javax.management.ReflectionException; import javax.management.ReflectionException;
import javax.management.RuntimeMBeanException;
import javax.management.openmbean.CompositeData; import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeType; import javax.management.openmbean.CompositeType;
import javax.management.openmbean.TabularData; import javax.management.openmbean.TabularData;
@ -308,6 +309,15 @@ public class JMXJsonServlet extends HttpServlet {
Object value = null; Object value = null;
try { try {
value = mBeanServer.getAttribute(oname, attName); value = mBeanServer.getAttribute(oname, attName);
} catch (RuntimeMBeanException e) {
// UnsupportedOperationExceptions happen in the normal course of business,
// so no need to log them as errors all the time.
if (e.getCause() instanceof UnsupportedOperationException) {
LOG.debug("getting attribute "+attName+" of "+oname+" threw an exception", e);
} else {
LOG.error("getting attribute "+attName+" of "+oname+" threw an exception", e);
}
return;
} catch (AttributeNotFoundException e) { } catch (AttributeNotFoundException e) {
//Ignored the attribute was not found, which should never happen because the bean //Ignored the attribute was not found, which should never happen because the bean
//just told us that it has this attribute, but if this happens just don't output //just told us that it has this attribute, but if this happens just don't output