org.apache.htrace.core.Tracer.wrap()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(158)

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

Tracer.wrap介绍

[英]Wrap the runnable in a TraceRunnable, if tracing
[中]如果需要跟踪,请将runnable包装在TraceRunnable中

代码示例

代码示例来源:origin: apache/hbase

/**
  * Wrap runnable with current tracer and description
  * @param runnable to wrap
  * @return wrapped runnable or original runnable when not tracing
  */
 public static Runnable wrap(Runnable runnable, String description) {
  return (tracer == null) ? runnable : tracer.wrap(runnable, description);
 }
}

代码示例来源:origin: brianfrankcooper/YCSB

threads.put(new Thread(tracer.wrap(client, "ClientThread")), client);

代码示例来源:origin: apache/hbase

return Collections.singletonList(runnable);
} else {
 return Collections.singletonList(tracer.wrap(runnable, "AsyncProcess.sendMultiAction"));

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

/**
  * Wrap runnable with current tracer and description
  * @param runnable to wrap
  * @return wrapped runnable or original runnable when not tracing
  */
 public static Runnable wrap(Runnable runnable, String description) {
  return (tracer == null) ? runnable : tracer.wrap(runnable, description);
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

/**
  * Wrap runnable with current tracer and description
  * @param runnable to wrap
  * @return wrapped runnable or original runnable when not tracing
  */
 public static Runnable wrap(Runnable runnable, String description) {
  return (tracer == null) ? runnable : tracer.wrap(runnable, description);
 }
}

代码示例来源:origin: apache/incubator-htrace

Runnable wrap(Runnable runnable) {
 return tracer.wrap(runnable, scopeName);
}

代码示例来源:origin: org.apache.hbase/hbase-client

return Collections.singletonList(runnable);
} else {
 return Collections.singletonList(tracer.wrap(runnable, "AsyncProcess.sendMultiAction"));

代码示例来源:origin: org.apache.htrace/htrace-core4

Runnable wrap(Runnable runnable) {
 return tracer.wrap(runnable, scopeName);
}

代码示例来源:origin: org.apache.htrace/htrace-core4

<V> Callable<V> wrap(Callable<V> callable) {
 return tracer.wrap(callable, scopeName);
}

代码示例来源:origin: apache/incubator-htrace

<V> Callable<V> wrap(Callable<V> callable) {
 return tracer.wrap(callable, scopeName);
}

代码示例来源:origin: org.apache.htrace/htrace-core

@Override
public <T> Future<T> submit(Runnable task, T result) {
 return impl.submit(tracer.wrap(task, scopeName), result);
}

代码示例来源:origin: org.apache.htrace/htrace-core

@Override
public Future<?> submit(Runnable task) {
 return impl.submit(tracer.wrap(task, scopeName));
}

代码示例来源:origin: org.apache.htrace/htrace-core

@Override
public void execute(Runnable command) {
 impl.execute(tracer.wrap(command, scopeName));
}

代码示例来源:origin: org.apache.htrace/htrace-core

@Override
public <T> Future<T> submit(Callable<T> task) {
 return impl.submit(tracer.wrap(task, scopeName));
}

代码示例来源:origin: org.apache.htrace/htrace-core

private <T> Collection<? extends Callable<T>> wrapCollection(
  Collection<? extends Callable<T>> tasks) {
 List<Callable<T>> result = new ArrayList<Callable<T>>();
 for (Callable<T> task : tasks) {
  result.add(tracer.wrap(task, scopeName));
 }
 return result;
}

代码示例来源:origin: apache/incubator-htrace

/**
 * Creates the demo trace (will create different traces from call to call).
 */
public void createThreadedTrace() {
 try (TraceScope s = tracer.newScope(THREADED_TRACE_ROOT)) {
  Random r = ThreadLocalRandom.current();
  int numThreads = r.nextInt(4) + 1;
  Thread[] threads = new Thread[numThreads];
  for (int i = 0; i < numThreads; i++) {
   threads[i] = new Thread(tracer.wrap(new MyRunnable(), null));
  }
  for (int i = 0; i < numThreads; i++) {
   threads[i].start();
  }
  for (int i = 0; i < numThreads; i++) {
   try {
    threads[i].join();
   } catch (InterruptedException e) {
   }
  }
  importantWork1();
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

return Collections.singletonList(runnable);
} else {
 return Collections.singletonList(tracer.wrap(runnable, "AsyncProcess.sendMultiAction"));

相关文章