HBASE-11603 Apply version of HADOOP-8027 to our JMXJsonServlet
This commit is contained in:
parent
ab15fc1411
commit
af2df3523a
|
@ -224,7 +224,7 @@ public class JMXJsonServlet extends HttpServlet {
|
|||
private void listBeans(JsonGenerator jg, ObjectName qry, String attribute,
|
||||
HttpServletResponse response)
|
||||
throws IOException {
|
||||
LOG.debug("Listing beans for "+qry);
|
||||
LOG.trace("Listing beans for "+qry);
|
||||
Set<ObjectName> names = null;
|
||||
names = mBeanServer.queryNames(qry, null);
|
||||
|
||||
|
@ -248,6 +248,17 @@ public class JMXJsonServlet extends HttpServlet {
|
|||
prs = attribute;
|
||||
attributeinfo = mBeanServer.getAttribute(oname, prs);
|
||||
}
|
||||
} 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) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Getting attribute " + prs + " of " + oname + " threw " + e);
|
||||
}
|
||||
} else {
|
||||
LOG.error("Getting attribute " + prs + " of " + oname + " threw an exception", e);
|
||||
}
|
||||
return;
|
||||
} catch (AttributeNotFoundException e) {
|
||||
// If the modelerType attribute was not found, the class name is used
|
||||
// instead.
|
||||
|
@ -316,7 +327,8 @@ public class JMXJsonServlet extends HttpServlet {
|
|||
jg.writeEndArray();
|
||||
}
|
||||
|
||||
private void writeAttribute(JsonGenerator jg, ObjectName oname, MBeanAttributeInfo attr) throws IOException {
|
||||
private void writeAttribute(JsonGenerator jg, ObjectName oname, MBeanAttributeInfo attr)
|
||||
throws IOException {
|
||||
if (!attr.isReadable()) {
|
||||
return;
|
||||
}
|
||||
|
@ -335,7 +347,9 @@ public class JMXJsonServlet extends HttpServlet {
|
|||
// 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);
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Getting attribute " + attName + " of " + oname + " threw " + e);
|
||||
}
|
||||
} else {
|
||||
LOG.error("getting attribute "+attName+" of "+oname+" threw an exception", e);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue