當前位置: 首頁>>代碼示例>>Java>>正文


Java PingServlet類代碼示例

本文整理匯總了Java中com.codahale.metrics.servlets.PingServlet的典型用法代碼示例。如果您正苦於以下問題:Java PingServlet類的具體用法?Java PingServlet怎麽用?Java PingServlet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PingServlet類屬於com.codahale.metrics.servlets包,在下文中一共展示了PingServlet類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: evaluateWeb

import com.codahale.metrics.servlets.PingServlet; //導入依賴的package包/類
private void evaluateWeb()
        throws Exception {
    if (!runPerServiceMode(web)) {
        return;
    }

    // Load balancers should hit the ping servlet, exposed on the main port to reflect main connection pool issues
    _environment.servlets().addServlet("/ping", new PingServlet());
    // Serve static assets
    _environment.jersey().register(FaviconResource.class);

    // Add a filter to provide finer 5xx metrics than the default DropWizard metrics include.
    //noinspection unchecked
    _environment.jersey().getResourceConfig().getContainerResponseFilters()
            .add(new ServerErrorResponseMetricsFilter(_environment.metrics()));
}
 
開發者ID:bazaarvoice,項目名稱:emodb,代碼行數:17,代碼來源:EmoService.java

示例2: registerMetricsServlets

import com.codahale.metrics.servlets.PingServlet; //導入依賴的package包/類
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");
}
 
開發者ID:dsmclaughlin,項目名稱:onerepmax,代碼行數:10,代碼來源:JettyServer.java

示例3: configure

import com.codahale.metrics.servlets.PingServlet; //導入依賴的package包/類
@Override
protected void configure() {
  // NOTE: AdminServletModule (metrics-guice integration) generates invalid links, so wire up servlets ourselves

  final Clock clock = Clock.defaultClock();
  bind(Clock.class).toInstance(clock);

  final JsonFactory jsonFactory = new JsonFactory(new ObjectMapper());
  bind(JsonFactory.class).toInstance(jsonFactory);

  install(new ServletModule()
  {
    @Override
    protected void configureServlets() {
      bind(MetricsServlet.class);
      bind(HealthCheckServlet.class);

      serve(MOUNT_POINT + "/ping").with(new PingServlet());
      serve(MOUNT_POINT + "/threads").with(new ThreadDumpServlet());
      serve(MOUNT_POINT + "/data").with(MetricsServlet.class);
      serve(MOUNT_POINT + "/healthcheck").with(HealthCheckServlet.class);

      // record metrics for all webapp access
      filter("/*").through(new InstrumentedFilter());

      bind(SecurityFilter.class);

      // configure security
      filter(MOUNT_POINT + "/*").through(SecurityFilter.class);
    }
  });

  // require permission to use endpoints
  install(new FilterChainModule()
  {
    @Override
    protected void configure() {
      addFilterChain(MOUNT_POINT + "/**",
          NexusAuthenticationFilter.NAME,
          AnonymousFilter.NAME,
          PermissionsFilter.config("nexus:metrics:read"));
    }
  });

  log.info("Metrics support configured");
}
 
開發者ID:sonatype,項目名稱:nexus-public,代碼行數:47,代碼來源:MetricsModule.java


注:本文中的com.codahale.metrics.servlets.PingServlet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。