Java 类com.codahale.metrics.servlets.ThreadDumpServlet 实例源码

项目:springboot-camel-metrics-publisher    文件:MetricsServletConfiguration.java   
/**
 * Registers {@link com.codahale.metrics.servlets.ThreadDumpServlet} with the application. This provides
 * an endpoint to capture JVM thread dump
 *
 * @return
 */
@Bean
public ServletRegistrationBean threadDumpServletRegistrationBean() {
    ThreadDumpServlet threadDumpServlet = new ThreadDumpServlet();
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(threadDumpServlet, monitoringServletsPath + "/threads");
    LOGGER.info("Codahale ThreadDumpServlet registered");
    return servletRegistrationBean;
}
项目:QDrill    文件:WebServer.java   
/**
 * Start the web server including setup.
 * @throws Exception
 */
public void start() throws Exception {
  if (embeddedJetty == null) {
    return;
  }

  final ServerConnector serverConnector;
  if (config.getBoolean(ExecConstants.HTTP_ENABLE_SSL)) {
    serverConnector = createHttpsConnector();
  } else {
    serverConnector = createHttpConnector();
  }
  embeddedJetty.addConnector(serverConnector);

  // Add resources
  final ErrorHandler errorHandler = new ErrorHandler();
  errorHandler.setShowStacks(true);
  errorHandler.setShowMessageInTitle(true);

  final ServletContextHandler servletContextHandler =
      new ServletContextHandler(ServletContextHandler.NO_SESSIONS);
  servletContextHandler.setErrorHandler(errorHandler);
  servletContextHandler.setContextPath("/");
  embeddedJetty.setHandler(servletContextHandler);

  final ServletHolder servletHolder = new ServletHolder(new ServletContainer(new DrillRestServer(workManager)));
  servletHolder.setInitOrder(1);
  servletContextHandler.addServlet(servletHolder, "/*");

  servletContextHandler.addServlet(
      new ServletHolder(new MetricsServlet(metrics)), "/status/metrics");
  servletContextHandler.addServlet(new ServletHolder(new ThreadDumpServlet()), "/status/threads");

  final ServletHolder staticHolder = new ServletHolder("static", DefaultServlet.class);
  staticHolder.setInitParameter("resourceBase", Resource.newClassPathResource("/rest/static").toString());
  staticHolder.setInitParameter("dirAllowed","false");
  staticHolder.setInitParameter("pathInfoOnly","true");
  servletContextHandler.addServlet(staticHolder,"/static/*");

  embeddedJetty.start();
}
项目:onerepmax    文件:JettyServer.java   
private void registerMetricsServlets(final ServletContextHandler context) {
  context.addEventListener(new ExampleHealthCheckServletContextListener());
  context.addEventListener(new ExampleMetricsServletContextListener());
  context.addServlet(AdminServlet.class, "/admin");
  context.addServlet(HealthCheckServlet.class, "/admin/healthcheck");
  context.addServlet(MetricsServlet.class, "/admin/metrics");
  context.addServlet(PingServlet.class, "/admin/ping");
  context.addServlet(ThreadDumpServlet.class, "/admin/threads");
}