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


Java Span类代码示例

本文整理汇总了Java中org.htrace.Span的典型用法代码示例。如果您正苦于以下问题:Java Span类的具体用法?Java Span怎么用?Java Span使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: DFSOutputStream

import org.htrace.Span; //导入依赖的package包/类
/** Construct a new output stream for creating a file. */
private DFSOutputStream(DFSClient dfsClient, String src, HdfsFileStatus stat,
    EnumSet<CreateFlag> flag, Progressable progress,
    DataChecksum checksum, String[] favoredNodes) throws IOException {
  this(dfsClient, src, progress, stat, checksum);
  this.shouldSyncBlock = flag.contains(CreateFlag.SYNC_BLOCK);

  computePacketChunkSize(dfsClient.getConf().writePacketSize, bytesPerChecksum);

  Span traceSpan = null;
  if (Trace.isTracing()) {
    traceSpan = Trace.startSpan(this.getClass().getSimpleName()).detach();
  }
  streamer = new DataStreamer(stat, traceSpan);
  if (favoredNodes != null && favoredNodes.length != 0) {
    streamer.setFavoredNodes(favoredNodes);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:19,代码来源:DFSOutputStream.java

示例2: makeRpcRequestHeader

import org.htrace.Span; //导入依赖的package包/类
public static RpcRequestHeaderProto makeRpcRequestHeader(RPC.RpcKind rpcKind,
    RpcRequestHeaderProto.OperationProto operation, int callId,
    int retryCount, byte[] uuid) {
  RpcRequestHeaderProto.Builder result = RpcRequestHeaderProto.newBuilder();
  result.setRpcKind(convert(rpcKind)).setRpcOp(operation).setCallId(callId)
      .setRetryCount(retryCount).setClientId(ByteString.copyFrom(uuid));

  // Add tracing info if we are currently tracing.
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    result.setTraceInfo(RPCTraceInfoProto.newBuilder()
        .setParentId(s.getSpanId())
        .setTraceId(s.getTraceId()).build());
  }

  return result.build();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:18,代码来源:ProtoUtil.java

示例3: DataStreamer

import org.htrace.Span; //导入依赖的package包/类
/**
 * construction with tracing info
 */
private DataStreamer(HdfsFileStatus stat, Span span) {
  isAppend = false;
  isLazyPersistFile = isLazyPersist(stat);
  stage = BlockConstructionStage.PIPELINE_SETUP_CREATE;
  traceSpan = span;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:10,代码来源:DFSOutputStream.java

示例4: releaseShortCircuitFds

import org.htrace.Span; //导入依赖的package包/类
@Override
public void releaseShortCircuitFds(SlotId slotId) throws IOException {
  ReleaseShortCircuitAccessRequestProto.Builder builder =
      ReleaseShortCircuitAccessRequestProto.newBuilder().
      setSlotId(PBHelper.convert(slotId));
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder()
        .setTraceId(s.getTraceId()).setParentId(s.getSpanId()));
  }
  ReleaseShortCircuitAccessRequestProto proto = builder.build();
  send(out, Op.RELEASE_SHORT_CIRCUIT_FDS, proto);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:14,代码来源:Sender.java

示例5: requestShortCircuitShm

import org.htrace.Span; //导入依赖的package包/类
@Override
public void requestShortCircuitShm(String clientName) throws IOException {
  ShortCircuitShmRequestProto.Builder builder =
      ShortCircuitShmRequestProto.newBuilder().
      setClientName(clientName);
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder()
        .setTraceId(s.getTraceId()).setParentId(s.getSpanId()));
  }
  ShortCircuitShmRequestProto proto = builder.build();
  send(out, Op.REQUEST_SHORT_CIRCUIT_SHM, proto);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:14,代码来源:Sender.java

示例6: buildBaseHeader

import org.htrace.Span; //导入依赖的package包/类
static BaseHeaderProto buildBaseHeader(ExtendedBlock blk,
    Token<BlockTokenIdentifier> blockToken) {
  BaseHeaderProto.Builder builder =  BaseHeaderProto.newBuilder()
    .setBlock(PBHelper.convert(blk))
    .setToken(PBHelper.convert(blockToken));
  if (Trace.isTracing()) {
    Span s = Trace.currentSpan();
    builder.setTraceInfo(DataTransferTraceInfoProto.newBuilder()
        .setTraceId(s.getTraceId())
        .setParentId(s.getSpanId()));
  }
  return builder.build();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:14,代码来源:DataTransferProtoUtil.java

示例7: getMap

import org.htrace.Span; //导入依赖的package包/类
public static Map<String, List<Span>> getMap() {
  Map<String, List<Span>> map = new HashMap<String, List<Span>>();

  for (Span s : spans.values()) {
    List<Span> l = map.get(s.getDescription());
    if (l == null) {
      l = new LinkedList<Span>();
      map.put(s.getDescription(), l);
    }
    l.add(s);
  }
  return map;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:14,代码来源:TestTracing.java

示例8: Call

import org.htrace.Span; //导入依赖的package包/类
public Call(int id, int retryCount, Writable param, Connection connection,
    RPC.RpcKind kind, byte[] clientId, Span span) {
  this.callId = id;
  this.retryCount = retryCount;
  this.rpcRequest = param;
  this.connection = connection;
  this.timestamp = Time.now();
  this.rpcResponse = null;
  this.rpcKind = kind;
  this.clientId = clientId;
  this.traceSpan = span;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:13,代码来源:Server.java

示例9: publishSyncOnRingBuffer

import org.htrace.Span; //导入依赖的package包/类
private SyncFuture publishSyncOnRingBuffer(Span span) {
  long sequence = this.disruptor.getRingBuffer().next();
  SyncFuture syncFuture = getSyncFuture(sequence, span);
  try {
    RingBufferTruck truck = this.disruptor.getRingBuffer().get(sequence);
    truck.loadPayload(syncFuture);
  } finally {
    this.disruptor.getRingBuffer().publish(sequence);
  }
  return syncFuture;
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:12,代码来源:FSHLog.java

示例10: blockOnSync

import org.htrace.Span; //导入依赖的package包/类
private Span blockOnSync(final SyncFuture syncFuture) throws IOException {
  // Now we have published the ringbuffer, halt the current thread until we get an answer back.
  try {
    syncFuture.get();
    return syncFuture.getSpan();
  } catch (InterruptedException ie) {
    LOG.warn("Interrupted", ie);
    throw convertInterruptedExceptionToIOException(ie);
  } catch (ExecutionException e) {
    throw ensureIOException(e.getCause());
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:13,代码来源:FSHLog.java

示例11: getSyncFuture

import org.htrace.Span; //导入依赖的package包/类
private SyncFuture getSyncFuture(final long sequence, Span span) {
  SyncFuture syncFuture = this.syncFuturesByHandler.get(Thread.currentThread());
  if (syncFuture == null) {
    syncFuture = new SyncFuture();
    this.syncFuturesByHandler.put(Thread.currentThread(), syncFuture);
  }
  return syncFuture.reset(sequence, span);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:9,代码来源:FSHLog.java

示例12: reset

import org.htrace.Span; //导入依赖的package包/类
/**
 * Call this method to clear old usage and get it ready for new deploy. Call
 * this method even if it is being used for the first time.
 *
 * @param sequence sequenceId from this Future's position in the RingBuffer
 * @param span curren span, detached from caller. Don't forget to attach it when
 *             resuming after a call to {@link #get()}.
 * @return this
 */
synchronized SyncFuture reset(final long sequence, Span span) {
  if (t != null && t != Thread.currentThread()) throw new IllegalStateException();
  t = Thread.currentThread();
  if (!isDone()) throw new IllegalStateException("" + sequence + " " + Thread.currentThread());
  this.doneSequence = NOT_DONE;
  this.ringBufferSequence = sequence;
  this.span = span;
  return this;
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:19,代码来源:SyncFuture.java

示例13: addResult

import org.htrace.Span; //导入依赖的package包/类
/**
 * Add a result to this aggregate result.
 * @param time Time in nanoseconds
 * @param span Span.  To be kept if the time taken was over 1 second
 */
public void addResult(long time, Span span) {
  stats.addValue(TimeUnit.MILLISECONDS.convert(time, TimeUnit.NANOSECONDS));
  if (TimeUnit.SECONDS.convert(time, TimeUnit.NANOSECONDS) >= 1) {
    traces.add(span.getTraceId());
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:12,代码来源:IntegrationTestMTTR.java

示例14: sendCall

import org.htrace.Span; //导入依赖的package包/类
public CallFuture sendCall(Call call, int priority, Span span)
    throws InterruptedException, IOException {
  CallFuture cts = new CallFuture(call, priority, span);
  callsToWrite.add(cts);
  checkIsOpen(); // We check after the put, to be sure that the call we added won't stay
                 //  in the list while the cleanup was already done.
  return cts;
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:9,代码来源:RpcClient.java

示例15: tracedWriteRequest

import org.htrace.Span; //导入依赖的package包/类
protected void tracedWriteRequest(Call call, int priority, Span span) throws IOException {
  TraceScope ts = Trace.continueSpan(span);
  try {
    writeRequest(call, priority, span);
  } finally {
    ts.close();
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:9,代码来源:RpcClient.java


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