hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1441703 - /hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java
Date Sat, 02 Feb 2013 05:59:39 GMT
Author: jxiang
Date: Sat Feb  2 05:59:39 2013
New Revision: 1441703

URL: http://svn.apache.org/viewvc?rev=1441703&view=rev
Log:
HBASE-7738 REST server should publish metrics that are available via HTTP - ADDENDUM

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java?rev=1441703&r1=1441702&r2=1441703&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java (original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/rest/Main.java Sat Feb  2 05:59:39
2013
@@ -158,24 +158,31 @@ public class Main implements Constants {
     server.setSendDateHeader(false);
     server.setStopAtShutdown(true);
 
-    // set up the JMX servlet container for Jetty
-    ServletHolder jmx = new ServletHolder(JMXJsonServlet.class);
-    // set up the metrics servlet container for Jetty
-    ServletHolder metrics = new ServletHolder(MetricsServlet.class);
-
-    String metricsPath =
-      servlet.getConfiguration().get("hbase.rest.path.metrics", "/metrics");
-    String jmxPath =
-      servlet.getConfiguration().get("hbase.rest.path.jmx", "/jmx");
-
       // set up context
     Context context = new Context(server, "/", Context.SESSIONS);
-    context.addServlet(metrics, metricsPath);
-    context.addServlet(jmx, jmxPath);
     context.addServlet(sh, "/*");
     context.addFilter(GzipFilter.class, "/*", 0);
 
-    context.getServletContext().setAttribute("hadoop.conf", conf);
+    // Disable the JMX and metrics servlet by default so that
+    // not to confuse existing applications use jmx/metrics as table name
+    if (servlet.getConfiguration().getBoolean(
+        "hbase.rest.enable.jmx_metrics", false)) {
+
+      // set up the JMX servlet container for Jetty
+      ServletHolder jmx = new ServletHolder(JMXJsonServlet.class);
+      // set up the metrics servlet container for Jetty
+      ServletHolder metrics = new ServletHolder(MetricsServlet.class);
+
+      String metricsPath =
+        servlet.getConfiguration().get("hbase.rest.path.metrics", "/metrics");
+      String jmxPath =
+        servlet.getConfiguration().get("hbase.rest.path.jmx", "/jmx");
+
+      context.addServlet(metrics, metricsPath);
+      context.addServlet(jmx, jmxPath);
+
+      context.getServletContext().setAttribute("hadoop.conf", conf);
+    }
 
     // login the server principal (if using secure Hadoop)
     if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {



Mime
View raw message