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


Java Trace.addReceiver方法代码示例

本文整理汇总了Java中org.apache.htrace.Trace.addReceiver方法的典型用法代码示例。如果您正苦于以下问题:Java Trace.addReceiver方法的具体用法?Java Trace.addReceiver怎么用?Java Trace.addReceiver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.htrace.Trace的用法示例。


在下文中一共展示了Trace.addReceiver方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadSpanReceivers

import org.apache.htrace.Trace; //导入方法依赖的package包/类
/**
 * Reads the names of classes specified in the {@code hbase.trace.spanreceiver.classes} property
 * and instantiates and registers them with the Tracer.
 *
 */
public void loadSpanReceivers() {
  String[] receiverNames = conf.getStrings(SPAN_RECEIVERS_CONF_KEY);
  if (receiverNames == null || receiverNames.length == 0) {
    return;
  }

  SpanReceiverBuilder builder = new SpanReceiverBuilder(new HBaseHTraceConfiguration(conf));
  for (String className : receiverNames) {
    className = className.trim();

    SpanReceiver receiver = builder.spanReceiverClass(className).build();
    if (receiver != null) {
      receivers.add(receiver);
      LOG.info("SpanReceiver " + className + " was loaded successfully.");
    }
  }
  for (SpanReceiver rcvr : receivers) {
    Trace.addReceiver(rcvr);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:SpanReceiverHost.java

示例2: loadSpanReceivers

import org.apache.htrace.Trace; //导入方法依赖的package包/类
/**
 * Reads the names of classes specified in the
 * "hadoop.htrace.spanreceiver.classes" property and instantiates and registers
 * them with the Tracer as SpanReceiver's.
 *
 * The nullary constructor is called during construction, but if the classes
 * specified implement the Configurable interface, setConfiguration() will be
 * called on them. This allows SpanReceivers to use values from the Hadoop
 * configuration.
 */
public synchronized void loadSpanReceivers(Configuration conf) {
  config = new Configuration(conf);
  String receiverKey = confPrefix + SPAN_RECEIVERS_CONF_SUFFIX;
  String[] receiverNames = config.getTrimmedStrings(receiverKey);
  if (receiverNames == null || receiverNames.length == 0) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("No span receiver names found in " + receiverKey + ".");
    }
    return;
  }
  // It's convenient to have each daemon log to a random trace file when
  // testing.
  String pathKey = confPrefix + LOCAL_FILE_SPAN_RECEIVER_PATH_SUFFIX;
  if (config.get(pathKey) == null) {
    String uniqueFile = getUniqueLocalTraceFileName();
    config.set(pathKey, uniqueFile);
    if (LOG.isTraceEnabled()) {
      LOG.trace("Set " + pathKey + " to " + uniqueFile);
    }
  }
  for (String className : receiverNames) {
    try {
      SpanReceiver rcvr = loadInstance(className, EMPTY);
      Trace.addReceiver(rcvr);
      receivers.put(highestId++, rcvr);
      LOG.info("Loaded SpanReceiver " + className + " successfully.");
    } catch (IOException e) {
      LOG.error("Failed to load SpanReceiver", e);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:42,代码来源:SpanReceiverHost.java

示例3: before

import org.apache.htrace.Trace; //导入方法依赖的package包/类
@BeforeClass
public static void before() throws Exception {

  // Find out what the right value to use fo SPAN_ROOT_ID after HTRACE-111. We use HTRACE-32
  // to find out to detect if we are using HTrace 3.2 or not.
  try {
      Method m = Span.class.getMethod("addKVAnnotation", String.class, String.class);
  } catch (NoSuchMethodException e) {
    ROOT_SPAN_ID = 0x74aceL; // Span.SPAN_ROOT_ID pre HTrace-3.2
  }

  TEST_UTIL.startMiniCluster(2, 3);
  rcvr = new POJOSpanReceiver(new HBaseHTraceConfiguration(TEST_UTIL.getConfiguration()));
  Trace.addReceiver(rcvr);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestHTraceHooks.java

示例4: before

import org.apache.htrace.Trace; //导入方法依赖的package包/类
@BeforeClass
public static void before() throws Exception {
  TEST_UTIL.startMiniCluster(2, 3);
  rcvr = new POJOSpanReceiver(new HBaseHTraceConfiguration(TEST_UTIL.getConfiguration()));
  Trace.addReceiver(rcvr);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:7,代码来源:TestHTraceHooks.java


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