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


Java Servers类代码示例

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


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

示例1: init

import org.apache.hadoop.metrics2.util.Servers; //导入依赖的package包/类
public void init(SubsetConfiguration conf) {
  LOG.debug("Initializing the GangliaSink for Ganglia metrics.");

  this.conf = conf;

  // Take the hostname from the DNS class.
  if (conf.getString("slave.host.name") != null) {
    hostName = conf.getString("slave.host.name");
  } else {
    try {
      hostName = DNS.getDefaultHost(
          conf.getString("dfs.datanode.dns.interface", "default"),
          conf.getString("dfs.datanode.dns.nameserver", "default"));
    } catch (UnknownHostException uhe) {
      LOG.error(uhe);
      hostName = "UNKNOWN.example.com";
    }
  }

  // load the gannglia servers from properties
  metricsServers = Servers.parse(conf.getString(SERVERS_PROPERTY),
      DEFAULT_PORT);

  // extract the Ganglia conf per metrics
  gangliaConfMap = new HashMap<String, GangliaConf>();
  loadGangliaConf(GangliaConfType.units);
  loadGangliaConf(GangliaConfType.tmax);
  loadGangliaConf(GangliaConfType.dmax);
  loadGangliaConf(GangliaConfType.slope);

  try {
    datagramSocket = new DatagramSocket();
  } catch (SocketException se) {
    LOG.error(se);
  }

  // see if sparseMetrics is supported. Default is false
  supportSparseMetrics = conf.getBoolean(SUPPORT_SPARSE_METRICS_PROPERTY,
      SUPPORT_SPARSE_METRICS_DEFAULT);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:41,代码来源:AbstractGangliaSink.java

示例2: init

import org.apache.hadoop.metrics2.util.Servers; //导入依赖的package包/类
@Override
public void init(SubsetConfiguration conf) {
  LOG.debug("Initializing the GangliaSink for Ganglia metrics.");

  this.conf = conf;

  // Take the hostname from the DNS class.
  if (conf.getString("slave.host.name") != null) {
    hostName = conf.getString("slave.host.name");
  } else {
    try {
      hostName = DNS.getDefaultHost(
          conf.getString("dfs.datanode.dns.interface", "default"),
          conf.getString("dfs.datanode.dns.nameserver", "default"));
    } catch (UnknownHostException uhe) {
      LOG.error(uhe);
      hostName = "UNKNOWN.example.com";
    }
  }

  // load the gannglia servers from properties
  metricsServers = Servers.parse(conf.getString(SERVERS_PROPERTY),
      DEFAULT_PORT);
  multicastEnabled = conf.getBoolean(MULTICAST_ENABLED_PROPERTY,
          DEFAULT_MULTICAST_ENABLED);
  multicastTtl = conf.getInt(MULTICAST_TTL_PROPERTY, DEFAULT_MULTICAST_TTL);

  // extract the Ganglia conf per metrics
  gangliaConfMap = new HashMap<String, GangliaConf>();
  loadGangliaConf(GangliaConfType.units);
  loadGangliaConf(GangliaConfType.tmax);
  loadGangliaConf(GangliaConfType.dmax);
  loadGangliaConf(GangliaConfType.slope);

  try {
    if (multicastEnabled) {
      LOG.info("Enabling multicast for Ganglia with TTL " + multicastTtl);
      datagramSocket = new MulticastSocket();
      ((MulticastSocket) datagramSocket).setTimeToLive(multicastTtl);
    } else {
      datagramSocket = new DatagramSocket();
    }
  } catch (IOException e) {
    LOG.error(e);
  }

  // see if sparseMetrics is supported. Default is false
  supportSparseMetrics = conf.getBoolean(SUPPORT_SPARSE_METRICS_PROPERTY,
      SUPPORT_SPARSE_METRICS_DEFAULT);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:51,代码来源:AbstractGangliaSink.java

示例3: init

import org.apache.hadoop.metrics2.util.Servers; //导入依赖的package包/类
public void init(SubsetConfiguration conf) {
  LOG.debug("Initializing the GangliaSink for Ganglia metrics.");

  this.conf = conf;

  // Take the hostname from the DNS class.
  if (conf.getString("slave.host.name") != null) {
    hostName = conf.getString("slave.host.name");
  } else {
    try {
      hostName = DNS.getDefaultHost(
          conf.getString("dfs.datanode.dns.interface", "default"),
          conf.getString("dfs.datanode.dns.nameserver", "default"));
    } catch (UnknownHostException uhe) {
      LOG.error(uhe);
      hostName = "UNKNOWN.example.com";
    }
  }

  // load the gannglia servers from properties
  metricsServers = Servers.parse(conf.getString(SERVERS_PROPERTY),
      DEFAULT_PORT);
  multicastEnabled = conf.getBoolean(MULTICAST_ENABLED_PROPERTY,
          DEFAULT_MULTICAST_ENABLED);
  multicastTtl = conf.getInt(MULTICAST_TTL_PROPERTY, DEFAULT_MULTICAST_TTL);

  // extract the Ganglia conf per metrics
  gangliaConfMap = new HashMap<String, GangliaConf>();
  loadGangliaConf(GangliaConfType.units);
  loadGangliaConf(GangliaConfType.tmax);
  loadGangliaConf(GangliaConfType.dmax);
  loadGangliaConf(GangliaConfType.slope);

  try {
    if (multicastEnabled) {
      LOG.info("Enabling multicast for Ganglia with TTL " + multicastTtl);
      datagramSocket = new MulticastSocket();
      ((MulticastSocket) datagramSocket).setTimeToLive(multicastTtl);
    } else {
      datagramSocket = new DatagramSocket();
    }
  } catch (IOException e) {
    LOG.error(e);
  }

  // see if sparseMetrics is supported. Default is false
  supportSparseMetrics = conf.getBoolean(SUPPORT_SPARSE_METRICS_PROPERTY,
      SUPPORT_SPARSE_METRICS_DEFAULT);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:AbstractGangliaSink.java


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