anoopsjohn commented on a change in pull request #2370:
URL: https://github.com/apache/hbase/pull/2370#discussion_r486115737
##########
File path: hbase-http/src/main/java/org/apache/hadoop/hbase/util/JSONBean.java
##########
@@ -125,11 +130,13 @@ public int write(MBeanServer mBeanServer, ObjectName qry,
String attribute,
*/
private static int write(JsonWriter writer, MBeanServer mBeanServer,
ObjectName qry,
String attribute, boolean description) throws IOException {
- LOG.trace("Listing beans for " + qry);
+ LOG.debug("Listing beans for " + qry);
Review comment:
Wanted this log level change?
##########
File path: hbase-http/src/main/java/org/apache/hadoop/hbase/util/JSONBean.java
##########
@@ -125,11 +130,13 @@ public int write(MBeanServer mBeanServer, ObjectName qry,
String attribute,
*/
private static int write(JsonWriter writer, MBeanServer mBeanServer,
ObjectName qry,
String attribute, boolean description) throws IOException {
- LOG.trace("Listing beans for " + qry);
+ LOG.debug("Listing beans for " + qry);
Set<ObjectName> names = null;
names = mBeanServer.queryNames(qry, null);
writer.name("beans").beginArray();
Iterator<ObjectName> it = names.iterator();
+ boolean pattern = false;
Review comment:
You can avoid this boolean. Just use String[] and check for null value
and call diff write methods?
##########
File path: hbase-http/src/main/java/org/apache/hadoop/hbase/util/JSONBean.java
##########
@@ -237,6 +267,22 @@ private static void writeAttribute(JsonWriter writer,
MBeanServer mBeanServer, O
if (attName.indexOf("=") >= 0 || attName.indexOf(":") >= 0 ||
attName.indexOf(" ") >= 0) {
return;
}
+
+ if (pattern != null) {
+ boolean matchFound = false;
+ for (String patt : pattern) {
+ Pattern compile = Pattern.compile(patt);
Review comment:
We are compiling this pattern for each and every MBean attribute. This
will be costly. we could have compiled the attribute and kept that in an Array
at 1st step itself (instead of keeping the regex patterns in String[])
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]