• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UDPAddressingMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: start

import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode; //导入依赖的package包/类
@Override
public void start(Settings settings, MetricRegistry metricRegistry) {
    if (settings.getBoolean("metrics.ganglia.enabled", false)) {

        final String hostname = settings.getLocalHostname();
        final String address = settings.getRequiredString("metrics.ganglia.address");
        final int port = settings.getInteger("metrics.ganglia.port", 8649);
        final long period = settings.getDuration("metrics.ganglia.period", TimeUnit.SECONDS, 60);

        try {
            GMetric ganglia = new GMetric(address, port, UDPAddressingMode.MULTICAST, 1);
            reporter = GangliaReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)
                    .convertDurationsTo(TimeUnit.MILLISECONDS).build(ganglia);
            reporter.start(period, TimeUnit.SECONDS);

            log.info("Started Ganglia Metrics reporter for '{}', updating every {} seconds", hostname, period);

        } catch (IOException e) {
            log.error("Failed to start Ganglia reporter!", e);
        }

    } else {
        log.debug("Ganglia Metrics reporter is disabled");
    }
}
 
开发者ID:gitblit,项目名称:fathom,代码行数:26,代码来源:Reporter.java


示例2: start

import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode; //导入依赖的package包/类
@Override
public void start(PippoSettings settings, MetricRegistry metricRegistry) {
	if (settings.getBoolean("metrics.ganglia.enabled", false)) {

		final String hostname = settings.getLocalHostname();
		final String address = settings.getRequiredString("metrics.ganglia.address");
		final int port = settings.getInteger("metrics.ganglia.port", 8649);
		final long period = settings.getDurationInSeconds("metrics.ganglia.period", 60);

		try {
			GMetric ganglia = new GMetric(address, port, UDPAddressingMode.MULTICAST, 1);
			reporter = GangliaReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)
					.convertDurationsTo(TimeUnit.MILLISECONDS).build(ganglia);
			reporter.start(period, TimeUnit.SECONDS);

			log.info("Started Ganglia Metrics reporter for '{}', updating every {} seconds", hostname, period);

		} catch (IOException e) {
			log.error("Failed to start Ganglia reporter!", e);
		}

	} else {
		log.debug("Ganglia Metrics reporter is disabled");
	}
}
 
开发者ID:decebals,项目名称:pippo,代码行数:26,代码来源:Reporter.java


示例3: configureMetricsGangliaReporter

import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode; //导入依赖的package包/类
private void configureMetricsGangliaReporter() {
    if (configuration.has(GANGLIA_HOST_OR_GROUP)) {
        final String host = configuration.get(GANGLIA_HOST_OR_GROUP);
        final Duration ival = configuration.get(GANGLIA_INTERVAL);
        final Integer port = configuration.get(GANGLIA_PORT);

        final UDPAddressingMode addrMode;
        final String addrModeStr = configuration.get(GANGLIA_ADDRESSING_MODE);
        if (addrModeStr.equalsIgnoreCase("multicast")) {
            addrMode = UDPAddressingMode.MULTICAST;
        } else if (addrModeStr.equalsIgnoreCase("unicast")) {
            addrMode = UDPAddressingMode.UNICAST;
        } else throw new AssertionError();

        final Boolean proto31 = configuration.get(GANGLIA_USE_PROTOCOL_31);

        final int ttl = configuration.get(GANGLIA_TTL);

        final UUID uuid = configuration.has(GANGLIA_UUID)? UUID.fromString(configuration.get(GANGLIA_UUID)):null;

        String spoof = null;
        if (configuration.has(GANGLIA_SPOOF)) spoof = configuration.get(GANGLIA_SPOOF);

        try {
            MetricManager.INSTANCE.addGangliaReporter(host, port, addrMode, ttl, proto31, uuid, spoof, ival);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:31,代码来源:GraphDatabaseConfiguration.java


示例4: initGangliaPublish

import info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode; //导入依赖的package包/类
/**
 * Initialize publishing by Ganglia.
 * <p>
 * Only the summary registry is published.
 * 
 * @param repo  the component repository, not null
 * @param summaryRegistry  the summary metrics registry, not null
 * @param detailedRegistry  the detailed metrics registry, not null
 */
protected void initGangliaPublish(ComponentRepository repo, MetricRegistry summaryRegistry, MetricRegistry detailedRegistry) throws IOException {
  ArgumentChecker.notNull(getGangliaAddress(), "gangliaAddress");
  ArgumentChecker.notNull(getGangliaPort(), "gangliaPort");
  ArgumentChecker.notNull(getGangliaAddressingMode(), "gangliaAddressingMode");
  ArgumentChecker.notNull(getGangliaTtl(), "gangliaTtl");
  GMetric ganglia = new GMetric(getGangliaAddress(), getGangliaPort(), UDPAddressingMode.valueOf(getGangliaAddressingMode()), getGangliaTtl(), true);
  GangliaReporter gangliaReporter = GangliaReporter.forRegistry(summaryRegistry)
      .convertRatesTo(TimeUnit.SECONDS)
      .convertDurationsTo(TimeUnit.MILLISECONDS)
      .build(ganglia);
  repo.registerLifecycle(new GangliaReporterLifecycle(gangliaReporter));
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:22,代码来源:MetricsRepositoryComponentFactory.java



注:本文中的info.ganglia.gmetric4j.gmetric.GMetric.UDPAddressingMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EasyAuthenticationHandlerFactory类代码示例发布时间:2022-05-23
下一篇:
Java Tag类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap