本文整理汇总了Java中org.apache.hadoop.metrics.util.MetricsBase.getName方法的典型用法代码示例。如果您正苦于以下问题:Java MetricsBase.getName方法的具体用法?Java MetricsBase.getName怎么用?Java MetricsBase.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.metrics.util.MetricsBase
的用法示例。
在下文中一共展示了MetricsBase.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.hadoop.metrics.util.MetricsBase; //导入方法依赖的package包/类
protected void init() {
List<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>();
MBeanInfo parentInfo = super.getMBeanInfo();
List<String> parentAttributes = new ArrayList<String>();
for (MBeanAttributeInfo attr : parentInfo.getAttributes()) {
attributes.add(attr);
parentAttributes.add(attr.getName());
}
this.registryLength = this.registry.getMetricsList().size();
for (MetricsBase metric : this.registry.getMetricsList()) {
if (metric.getName() == null || parentAttributes.contains(metric.getName()))
continue;
// add on custom HBase metric types
if (metric instanceof MetricsRate) {
attributes.add( new MBeanAttributeInfo(metric.getName(),
"java.lang.Float", metric.getDescription(), true, false, false) );
extendedAttributes.put(metric.getName(), metric);
} else if (metric instanceof MetricsString) {
attributes.add( new MBeanAttributeInfo(metric.getName(),
"java.lang.String", metric.getDescription(), true, false, false) );
extendedAttributes.put(metric.getName(), metric);
LOG.info("MetricsString added: " + metric.getName());
}
// else, its probably a hadoop metric already registered. Skip it.
}
LOG.info("new MBeanInfo");
this.extendedInfo = new MBeanInfo( this.getClass().getName(),
this.description, attributes.toArray( new MBeanAttributeInfo[0] ),
parentInfo.getConstructors(), parentInfo.getOperations(),
parentInfo.getNotifications() );
}
示例2: init
import org.apache.hadoop.metrics.util.MetricsBase; //导入方法依赖的package包/类
protected void init() {
List<MBeanAttributeInfo> attributes = new ArrayList<MBeanAttributeInfo>();
MBeanInfo parentInfo = super.getMBeanInfo();
List<String> parentAttributes = new ArrayList<String>();
for (MBeanAttributeInfo attr : parentInfo.getAttributes()) {
attributes.add(attr);
parentAttributes.add(attr.getName());
}
this.registryLength = this.registry.getMetricsList().size();
for (MetricsBase metric : this.registry.getMetricsList()) {
if (metric.getName() == null || parentAttributes.contains(metric.getName()))
continue;
// add on custom HBase metric types
if (metric instanceof MetricsRate) {
attributes.add( new MBeanAttributeInfo(metric.getName(),
"java.lang.Float", metric.getDescription(), true, false, false) );
extendedAttributes.put(metric.getName(), metric);
} else if (metric instanceof MetricsString) {
attributes.add( new MBeanAttributeInfo(metric.getName(),
"java.lang.String", metric.getDescription(), true, false, false) );
extendedAttributes.put(metric.getName(), metric);
LOG.info("MetricsString added: " + metric.getName());
} else if (metric instanceof MetricsHistogram) {
String metricName = metric.getName() + MetricsHistogram.NUM_OPS_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Long", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.MIN_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Long", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.MAX_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Long", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.MEAN_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Float", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.STD_DEV_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Float", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.MEDIAN_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Float", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.SEVENTY_FIFTH_PERCENTILE_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Float", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.NINETY_FIFTH_PERCENTILE_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Float", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
metricName = metric.getName() + MetricsHistogram.NINETY_NINETH_PERCENTILE_METRIC_NAME;
attributes.add(new MBeanAttributeInfo(metricName,
"java.lang.Float", metric.getDescription(), true, false, false));
extendedAttributes.put(metricName, metric);
}
// else, its probably a hadoop metric already registered. Skip it.
}
LOG.info("new MBeanInfo");
this.extendedInfo = new MBeanInfo( this.getClass().getName(),
this.description, attributes.toArray( new MBeanAttributeInfo[0] ),
parentInfo.getConstructors(), parentInfo.getOperations(),
parentInfo.getNotifications() );
}