当前位置: 首页>>代码示例>>Java>>正文


Java Bootstrap.getMetricRegistry方法代码示例

本文整理汇总了Java中io.dropwizard.setup.Bootstrap.getMetricRegistry方法的典型用法代码示例。如果您正苦于以下问题:Java Bootstrap.getMetricRegistry方法的具体用法?Java Bootstrap.getMetricRegistry怎么用?Java Bootstrap.getMetricRegistry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.dropwizard.setup.Bootstrap的用法示例。


在下文中一共展示了Bootstrap.getMetricRegistry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration configuration)
        throws Exception {
    String serviceName = namespace.getString("service");

    CuratorFramework curator = configuration.getZooKeeperConfiguration().newCurator();
    curator.start();

    ZooKeeperHostDiscovery hostDiscovery = new ZooKeeperHostDiscovery(curator, serviceName, bootstrap.getMetricRegistry());

    for (ServiceEndPoint endPoint : hostDiscovery.getHosts()) {
        System.out.println(endPoint.getId());
    }

    hostDiscovery.close();
    curator.close();
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:18,代码来源:ListCassandraCommand.java

示例2: run

import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
protected final void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception {
    final Environment environment = new Environment(bootstrap.getApplication().getName(),
            bootstrap.getObjectMapper(),
            bootstrap.getValidatorFactory().getValidator(),
            bootstrap.getMetricRegistry(),
            bootstrap.getClassLoader());
    configuration.getMetricsFactory().configure(environment.lifecycle(),
            bootstrap.getMetricRegistry());
    bootstrap.run(configuration, environment);

    href = namespace.getString("href");

    try {
        cleanupAsynchronously();

    } catch (Exception e) {
        cleanup();
        throw e;
    }

    application.run(configuration, environment);
}
 
开发者ID:avoloshko,项目名称:WebCrawler,代码行数:24,代码来源:CrawlCommand.java

示例3: run

import io.dropwizard.setup.Bootstrap; //导入方法依赖的package包/类
@Override
protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration config)
        throws Exception {
    String host = namespace.getString("host");
    int limit = namespace.getInt("limit");
    String subscription = namespace.getString("subscription");
    String apiKey = namespace.getString("api_key");
    Set<String> tables = Sets.newHashSet(namespace.<String>getList("table"));
    List<String> keys = namespace.getList("key");
    Set<String> keySet = keys != null ? Sets.newHashSet(keys) : null;

    System.out.println("Connecting...");

    URI uri = URI.create(host).resolve(DatabusClient.SERVICE_PATH + "/_raw");
    MetricRegistry metricRegistry = bootstrap.getMetricRegistry();
    Client client = createDefaultJerseyClient(config.getHttpClientConfiguration(), metricRegistry, "");

    QueueService databus = QueueServiceAuthenticator.proxied(new QueueClient(uri, new JerseyEmoClient(client)))
            .usingCredentials(apiKey);

    for (;;) {
        List<Message> events = databus.peek(subscription, 5000);

        List<String> ids = Lists.newArrayList();
        for (Message event : events) {
            //noinspection unchecked
            Map<String, String> coord = (Map<String, String>) checkNotNull(event.getPayload());
            String table = checkNotNull(coord.get("table"));
            String key = checkNotNull(coord.get("key"));
            if (tables.contains(table) && (keySet == null || keySet.contains(key))) {
                ids.add(event.getId());
                if (--limit <= 0) {
                    break;
                }
            }
        }
        if (ids.isEmpty()) {
            System.out.println("All matching events of the first " + events.size() + " have been purged.");
            break;
        }

        System.out.println("Purging " + ids.size() + " events...");
        databus.acknowledge(subscription, ids);

        if (limit == 0) {
            System.out.println("Limit reached.");
            break;
        }
    }
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:51,代码来源:PurgeDatabusEventsCommand.java


注:本文中的io.dropwizard.setup.Bootstrap.getMetricRegistry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。