Search in sources :

Example 1 with LogLevel

use of org.apache.hadoop.hbase.http.log.LogLevel in project hbase by apache.

the class HttpServer method addDefaultServlets.

/**
 * Add default servlets.
 */
protected void addDefaultServlets(ContextHandlerCollection contexts, Configuration conf) throws IOException {
    // set up default servlets
    addPrivilegedServlet("stacks", "/stacks", StackServlet.class);
    addPrivilegedServlet("logLevel", "/logLevel", LogLevel.Servlet.class);
    // Remove when we drop support for hbase on hadoop2.x.
    try {
        Class<?> clz = Class.forName("org.apache.hadoop.metrics.MetricsServlet");
        addPrivilegedServlet("metrics", "/metrics", clz.asSubclass(HttpServlet.class));
    } catch (Exception e) {
    // do nothing
    }
    addPrivilegedServlet("jmx", "/jmx", JMXJsonServlet.class);
    // might. Give them an option to not expose the service configuration to all users.
    if (conf.getBoolean(HTTP_PRIVILEGED_CONF_KEY, HTTP_PRIVILEGED_CONF_DEFAULT)) {
        addPrivilegedServlet("conf", "/conf", ConfServlet.class);
    } else {
        addUnprivilegedServlet("conf", "/conf", ConfServlet.class);
    }
    final String asyncProfilerHome = ProfileServlet.getAsyncProfilerHome();
    if (asyncProfilerHome != null && !asyncProfilerHome.trim().isEmpty()) {
        addPrivilegedServlet("prof", "/prof", ProfileServlet.class);
        Path tmpDir = Paths.get(ProfileServlet.OUTPUT_DIR);
        if (Files.notExists(tmpDir)) {
            Files.createDirectories(tmpDir);
        }
        ServletContextHandler genCtx = new ServletContextHandler(contexts, "/prof-output-hbase");
        genCtx.addServlet(ProfileOutputServlet.class, "/*");
        genCtx.setResourceBase(tmpDir.toAbsolutePath().toString());
        genCtx.setDisplayName("prof-output-hbase");
    } else {
        addUnprivilegedServlet("prof", "/prof", ProfileServlet.DisabledServlet.class);
        LOG.info("ASYNC_PROFILER_HOME environment variable and async.profiler.home system property " + "not specified. Disabling /prof endpoint.");
    }
}
Also used : Path(java.nio.file.Path) HttpServlet(javax.servlet.http.HttpServlet) ServletContextHandler(org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler) LogLevel(org.apache.hadoop.hbase.http.log.LogLevel) ServletException(javax.servlet.ServletException) URISyntaxException(java.net.URISyntaxException) MultiException(org.apache.hbase.thirdparty.org.eclipse.jetty.util.MultiException) FileNotFoundException(java.io.FileNotFoundException) BindException(java.net.BindException) InterruptedIOException(java.io.InterruptedIOException) HadoopIllegalArgumentException(org.apache.hadoop.HadoopIllegalArgumentException) IOException(java.io.IOException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 InterruptedIOException (java.io.InterruptedIOException)1 BindException (java.net.BindException)1 URISyntaxException (java.net.URISyntaxException)1 Path (java.nio.file.Path)1 ServletException (javax.servlet.ServletException)1 HttpServlet (javax.servlet.http.HttpServlet)1 HadoopIllegalArgumentException (org.apache.hadoop.HadoopIllegalArgumentException)1 LogLevel (org.apache.hadoop.hbase.http.log.LogLevel)1 ServletContextHandler (org.apache.hbase.thirdparty.org.eclipse.jetty.servlet.ServletContextHandler)1 MultiException (org.apache.hbase.thirdparty.org.eclipse.jetty.util.MultiException)1