本文整理汇总了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);
}
示例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);
}
示例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);
}