org.apache.hadoop.metrics2.annotation.Metrics.context()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.apache.hadoop.metrics2.annotation.Metrics.context()方法的一些代码示例,展示了Metrics.context()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metrics.context()方法的具体详情如下:
包路径:org.apache.hadoop.metrics2.annotation.Metrics
类名称:Metrics
方法名:context

Metrics.context介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

private MetricsRegistry initRegistry(Object source) {
 Class<?> cls = source.getClass();
 MetricsRegistry r = null;
 // Get the registry if it already exists.
 for (Field field : ReflectionUtils.getDeclaredFieldsIncludingInherited(cls)) {
  if (field.getType() != MetricsRegistry.class) continue;
  try {
   field.setAccessible(true);
   r = (MetricsRegistry) field.get(source);
   hasRegistry = r != null;
   break;
  } catch (Exception e) {
   LOG.warn("Error accessing field "+ field, e);
   continue;
  }
 }
 // Create a new registry according to annotation
 for (Annotation annotation : cls.getAnnotations()) {
  if (annotation instanceof Metrics) {
   Metrics ma = (Metrics) annotation;
   info = factory.getInfo(cls, ma);
   if (r == null) {
    r = new MetricsRegistry(info);
   }
   r.setContext(ma.context());
  }
 }
 if (r == null) return new MetricsRegistry(cls.getSimpleName());
 return r;
}

代码示例来源:origin: io.hops/hadoop-common

r = new MetricsRegistry(info);
r.setContext(ma.context());

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

r = new MetricsRegistry(info);
r.setContext(ma.context());

代码示例来源:origin: ch.cern.hadoop/hadoop-common

r = new MetricsRegistry(info);
r.setContext(ma.context());

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

r = new MetricsRegistry(info);
r.setContext(ma.context());

相关文章

微信公众号

最新文章

更多