• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java InstrumentedHandler类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.codahale.metrics.jetty9.InstrumentedHandler的典型用法代码示例。如果您正苦于以下问题:Java InstrumentedHandler类的具体用法?Java InstrumentedHandler怎么用?Java InstrumentedHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

InstrumentedHandler类属于com.codahale.metrics.jetty9包,在下文中一共展示了InstrumentedHandler类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: SchedulerApiServer

点赞 3

import com.codahale.metrics.jetty9.InstrumentedHandler; //导入依赖的package包/类
public SchedulerApiServer(SchedulerConfig schedulerConfig, Collection<Object> resources) {
    this.port = schedulerConfig.getApiServerPort();
    this.server = JettyHttpContainerFactory.createServer(
            UriBuilder.fromUri("http://0.0.0.0/").port(this.port).build(),
            new ResourceConfig(MultiPartFeature.class).registerInstances(new HashSet<>(resources)),
            false /* don't start yet. wait for start() call below. */);
    this.startTimeout = schedulerConfig.getApiServerInitTimeout();

    ServletContextHandler context = new ServletContextHandler();

    // Metrics + Prometheus
    Metrics.configureMetricsEndpoints(context, "/v1/metrics", "/v1/metrics/prometheus");

    // Resources
    ResourceConfig resourceConfig = new ResourceConfig(MultiPartFeature.class)
            .registerInstances(new HashSet<>(resources));
    ServletHolder resourceHolder = new ServletHolder(new ServletContainer(resourceConfig));
    context.addServlet(resourceHolder, "/*");

    final InstrumentedHandler handler = new InstrumentedHandler(Metrics.getRegistry());
    handler.setHandler(context);
    server.setHandler(handler);
}
 

开发者ID:mesosphere,
项目名称:dcos-commons,
代码行数:24,
代码来源:SchedulerApiServer.java

示例2: getAPIJettyServer

点赞 2

import com.codahale.metrics.jetty9.InstrumentedHandler; //导入依赖的package包/类
/**
 * Creates the Jetty server instance for the Flux API endpoint.
 * @param port where the service is available.
 * @return Jetty Server instance
 */
@Named("APIJettyServer")
@Provides
@Singleton
Server getAPIJettyServer(@Named("Api.service.port") int port,
						 @Named("APIResourceConfig")ResourceConfig resourceConfig,
						 @Named("Api.service.acceptors") int acceptorThreads,
						 @Named("Api.service.selectors") int selectorThreads,
						 @Named("Api.service.workers") int maxWorkerThreads,
						 ObjectMapper objectMapper, MetricRegistry metricRegistry) throws URISyntaxException, UnknownHostException {
	JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
	provider.setMapper(objectMapper);
	resourceConfig.register(provider);
	QueuedThreadPool threadPool = new QueuedThreadPool();
	threadPool.setMaxThreads(maxWorkerThreads);
	Server server = new Server(threadPool);
	ServerConnector http = new ServerConnector(server, acceptorThreads, selectorThreads);
	http.setPort(port);
	server.addConnector(http);
	ServletContextHandler context = new ServletContextHandler(server, "/*");
	ServletHolder servlet = new ServletHolder(new ServletContainer(resourceConfig));
	context.addServlet(servlet, "/*");

	final InstrumentedHandler handler = new InstrumentedHandler(metricRegistry);
	handler.setHandler(context);
	server.setHandler(handler);

	server.setStopAtShutdown(true);
	return server;
}
 

开发者ID:flipkart-incubator,
项目名称:flux,
代码行数:35,
代码来源:ContainerModule.java

示例3: getPoseidonHandler

点赞 2

import com.codahale.metrics.jetty9.InstrumentedHandler; //导入依赖的package包/类
private Handler getPoseidonHandler() {
    ServletContextHandler servletContextHandler = new ServletContextHandler();
    servletContextHandler.setContextPath("/");
    servletContextHandler.addServlet(new ServletHolder(getPoseidonServlet()), "/*");

    addFilters(servletContextHandler);

    InstrumentedHandler instrumentedHandler = new InstrumentedHandler(Metrics.getRegistry());
    instrumentedHandler.setHandler(servletContextHandler);
    return instrumentedHandler;
}
 

开发者ID:flipkart-incubator,
项目名称:Poseidon,
代码行数:12,
代码来源:Poseidon.java

示例4: additionalHandlers

点赞 2

import com.codahale.metrics.jetty9.InstrumentedHandler; //导入依赖的package包/类
@Override
protected List<Handler> additionalHandlers(){
    metricRegistry= new MetricRegistry();
    return Arrays.asList(new InstrumentedHandler(metricRegistry,"monitoring example"));
}
 

开发者ID:factoryfx,
项目名称:factoryfx,
代码行数:6,
代码来源:InstrumentedJettyServer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)