brave.internal.Nullable.<init>()方法的使用及代码示例

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

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

Nullable.<init>介绍

暂无

代码示例

代码示例来源:origin: openzipkin/brave

/**
 * Sets the current span in scope until the returned object is closed. It is a programming error
 * to drop or never close the result. Using try-with-resources is preferred for this reason.
 *
 * @param currentSpan span to place into scope or null to clear the scope
 */
public abstract Scope newScope(@Nullable TraceContext currentSpan);

代码示例来源:origin: openzipkin/brave

/**
 * The parent's {@link #spanId} or null if this the root span in a trace.
 *
 * @see #parentIdAsLong()
 */
@Nullable public final Long parentId() {
 return parentId != 0 ? parentId : null;
}

代码示例来源:origin: openzipkin/brave

/**
 * The entire URL, including the scheme, host and query parameters if available or null if
 * unreadable.
 *
 * <p>Conventionally associated with the key "http.url"
 */
@Nullable public abstract String url(Req request);

代码示例来源:origin: openzipkin/brave

/**
 * The HTTP status code or null if unreadable.
 *
 * <p>Conventionally associated with the key "http.status_code"
 *
 * @see #statusCodeAsInt(Object)
 */
@Nullable public abstract Integer statusCode(Resp response);

代码示例来源:origin: openzipkin/brave

/**
 * Returns an overriding sampling decision for a new trace. Return null ignore the request and use
 * the {@link brave.sampler.Sampler trace ID sampler}.
 */
@Nullable public abstract <Req> Boolean trySample(HttpAdapter<Req, ?> adapter, Req request);

代码示例来源:origin: openzipkin/brave

/**
  * Customizes the span based on the response received from the server.
  *
  * <p>{@inheritDoc}
  */
 @Override public <Resp> void response(HttpAdapter<?, Resp> adapter, @Nullable Resp res,
   @Nullable Throwable error, SpanCustomizer customizer) {
  super.response(adapter, res, error, customizer);
 }
}

代码示例来源:origin: openzipkin/brave

/**
  * Customizes the span based on the response sent to the client.
  *
  * <p>{@inheritDoc}
  */
 @Override public <Resp> void response(HttpAdapter<?, Resp> adapter, @Nullable Resp res,
   @Nullable Throwable error, SpanCustomizer customizer) {
  super.response(adapter, res, error, customizer);
 }
}

代码示例来源:origin: openzipkin/brave

/**
  * Finishes the client span after assigning it tags according to the response or error.
  *
  * <p>This is typically called once the response headers are received, and after the span is
  * {@link brave.Tracer.SpanInScope#close() no longer in scope}.
  *
  * @see HttpClientParser#response(HttpAdapter, Object, Throwable, SpanCustomizer)
  */
 public void handleReceive(@Nullable Resp response, @Nullable Throwable error, Span span) {
  handleFinish(response, error, span);
 }
}

代码示例来源:origin: openzipkin/brave

/** Returns the last value associated with the key or null */
@Nullable public String tag(String key) {
 if (key == null) throw new NullPointerException("key == null");
 if (key.isEmpty()) throw new IllegalArgumentException("key is empty");
 String result = null;
 for (int i = 0, length = tags.size(); i < length; i += 2) {
  if (key.equals(tags.get(i))) result = tags.get(i + 1);
 }
 return result;
}

代码示例来源:origin: openzipkin/brave

/** @see TraceContext#sampled() */
public Builder sampled(@Nullable Boolean sampled) {
 if (sampled == null) {
  flags &= ~(FLAG_SAMPLED_SET | FLAG_SAMPLED);
  return this;
 }
 return sampled(sampled.booleanValue());
}

代码示例来源:origin: openzipkin/brave

/**
 * The absolute http path, without any query parameters or null if unreadable. Ex.
 * "/objects/abcd-ff"
 *
 * <p>Conventionally associated with the key "http.path"
 * @see #route(Object)
 */
@Nullable public String path(Req request) {
 String url = url(request);
 if (url == null) return null;
 return URI.create(url).getPath(); // TODO benchmark
}

代码示例来源:origin: openzipkin/brave

@Nullable public String linkLocalIp() {
 // uses synchronized variant of double-checked locking as getting the endpoint can be expensive
 if (linkLocalIp != null) return linkLocalIp;
 synchronized (this) {
  if (linkLocalIp == null) {
   linkLocalIp = produceLinkLocalIp();
  }
 }
 return linkLocalIp;
}

代码示例来源:origin: openzipkin/brave

/** @see #localIp() */
public boolean localIp(@Nullable String localIp) {
 this.localIp = IpLiteral.ipOrNull(localIp);
 return true;
}

代码示例来源:origin: openzipkin/brave

/** @see brave.Span#remoteIpAndPort(String, int) */
public boolean remoteIpAndPort(@Nullable String remoteIp, int remotePort) {
 if (remoteIp == null) return false;
 this.remoteIp = IpLiteral.ipOrNull(remoteIp);
 if (this.remoteIp == null) return false;
 if (remotePort > 0xffff) throw new IllegalArgumentException("invalid port " + remotePort);
 if (remotePort < 0) remotePort = 0;
 this.remotePort = remotePort;
 return true;
}

代码示例来源:origin: openzipkin/brave

@Override public Scope newScope(@Nullable TraceContext currentSpan) {
  Scope scope = delegate.newScope(currentSpan);
  return decorateScope(currentSpan, scope);
 }
}

代码示例来源:origin: openzipkin/brave

public SamplingFlags sample(@Nullable P parameters) {
  if (parameters == null) return SamplingFlags.EMPTY;
  for (Rule<P> rule : rules) {
   if (rule.matches(parameters)) return rule.isSampled();
  }
  return SamplingFlags.EMPTY;
 }
}

代码示例来源:origin: openzipkin/brave

/**
 * Returns the value of the field with the specified key or null if not available.
 *
 * <p>Prefer {@link #get(TraceContext, String)} if you have a reference to a span.
 */
@Nullable public static String get(String name) {
 TraceContext context = currentTraceContext();
 return context != null ? get(context, name) : null;
}

代码示例来源:origin: openzipkin/brave

final void replace(String key, @Nullable String value) {
  if (value != null) {
   put(key, value);
  } else {
   remove(key);
  }
 }
}

代码示例来源:origin: openzipkin/brave

@Override public void onCompletion(RecordMetadata metadata, @Nullable Exception exception) {
  try (Scope ws = current.maybeScope(span.context())) {
   delegate.onCompletion(metadata, exception);
  } finally {
   super.onCompletion(metadata, exception);
  }
 }
}

代码示例来源:origin: openzipkin/brave

/**
 * Returns the {@link Tracer#nextSpan(TraceContextOrSamplingFlags)} or null if {@link
 * #CURRENT_TRACER} and tracing isn't available.
 */
@Nullable public Span next(TraceContextOrSamplingFlags extracted) {
 Tracer tracer = tracer();
 if (tracer == null) return null;
 Span next = tracer.nextSpan(extracted);
 Object[] spanAndScope = {next, tracer.withSpanInScope(next)};
 getCurrentSpanInScopeStack().addFirst(spanAndScope);
 return next;
}

相关文章

Nullable类方法