com.github.kristofa.brave.internal.Util.checkNotNull()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(219)

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

Util.checkNotNull介绍

[英]Copy of com.google.common.base.Preconditions#checkNotNull.
[中]com的副本。谷歌。常见的基础先决条件#checkNotNull。

代码示例

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * Creates a new instance.
 *
 * @param state Server span state, should not be <code>null</code>
 */
public ServerSpanThreadBinder(ServerSpanState state) {
  this.state = checkNotNull(state, "state");
}

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * Creates a new instance.
 *
 * @param state client span state, should not be <code>null</code>
 */
public ClientSpanThreadBinder(ClientSpanState state) {
  this.state = checkNotNull(state, "state");
}

代码示例来源:origin: io.zipkin.brave/brave-core

SpanId(Builder builder) {
 checkNotNull(builder.spanId, "spanId");
 this.traceIdHigh = builder.traceIdHigh;
 this.traceId = builder.traceId != null ? builder.traceId : builder.spanId;
 this.parentId = builder.nullableParentId != null ? builder.nullableParentId : this.traceId;
 this.spanId = builder.spanId;
 this.flags = builder.flags;
}

代码示例来源:origin: com.github.kristofa/brave-core

/**
 * Creates a new instance.
 * 
 * @param wrappedExecutor Wrapped ExecutorService to which execution will be delegated.
 * @param threadBinder Thread binder.
 */
public BraveExecutorService(final ExecutorService wrappedExecutor, final ServerSpanThreadBinder threadBinder) {
  this.wrappedExecutor = checkNotNull(wrappedExecutor, "Null wrappedExecutor");
  this.threadBinder = checkNotNull(threadBinder, "Null threadBinder");
}

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * Creates a new instance.
 *
 * @param state local span state, cannot be <code>null</code>
 */
public LocalSpanThreadBinder(LocalSpanState state) {
 this.state = checkNotNull(state, "state");
}

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * @param endpoint Endpoint of the local service being traced.
 */
public InheritableServerClientAndLocalSpanState(Endpoint endpoint) {
  this.endpoint = Util.checkNotNull(endpoint, "Endpoint must be specified.");
}

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * @deprecated use {@link #wrap(ExecutorService, Brave)} because this constructor loses thread
 * state for local span parents.
 */
@Deprecated
public BraveExecutorService(final ExecutorService wrappedExecutor, final ServerSpanThreadBinder serverSpanThreadBinder) {
  this.wrappedExecutor = checkNotNull(wrappedExecutor, "Null wrappedExecutor");
  this.localSpanThreadBinder = null;
  this.serverSpanThreadBinder = checkNotNull(serverSpanThreadBinder, "Null serverSpanThreadBinder");
}

代码示例来源:origin: com.github.kristofa/brave-core

public SpanId build() {
  long traceId = this.traceId != null ? this.traceId : checkNotNull(spanId, "spanId");
  long parentId = this.parentId != null ? this.parentId : traceId;
  return new SpanId(traceId, parentId, checkNotNull(spanId, "spanId"), flags);
 }
}

代码示例来源:origin: xuminwlt/j360-dubbo-app-all

public void report(Span span) {
    Util.checkNotNull(span, "Null span", new Object[0]);
    this.logger.info(Collections.singletonList(span).toString());
  }
}

代码示例来源:origin: io.zipkin.brave/brave-core

public static String checkNotBlank(String string, String errorMessageTemplate,
                  Object... errorMessageArgs) {
 if (checkNotNull(string, errorMessageTemplate, errorMessageArgs).trim().isEmpty()) {
  throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs));
 }
 return string;
}

代码示例来源:origin: io.zipkin.brave/brave-core

BraveExecutorService(ExecutorService wrappedExecutor, Brave brave) { // intentionally hidden
  this.wrappedExecutor = checkNotNull(wrappedExecutor, "wrappedExecutor");
  checkNotNull(brave, "brave");
  this.localSpanThreadBinder = brave.localSpanThreadBinder();
  this.serverSpanThreadBinder = brave.serverSpanThreadBinder();
}

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * Special-cased form supporting client address ("ca") and server address ("sa")
 *
 * @param key "ca" or "sa"
 * @param endpoint associated endpoint.
 */
public static BinaryAnnotation address(String key, Endpoint endpoint) {
 return create(key, new byte[] {1}, AnnotationType.BOOL, checkNotNull(endpoint, "endpoint"));
}

代码示例来源:origin: com.github.kristofa/brave-core

/**
 * Special-cased form supporting {@link zipkinCoreConstants#CLIENT_ADDR} and {@link
 * zipkinCoreConstants#SERVER_ADDR}.
 *
 * @param key {@link zipkinCoreConstants#CLIENT_ADDR} or {@link zipkinCoreConstants#SERVER_ADDR}
 * @param endpoint associated endpoint.
 */
public static BinaryAnnotation address(String key, Endpoint endpoint) {
 return create(key, new byte[] {1}, AnnotationType.BOOL, checkNotNull(endpoint, "endpoint"));
}

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * Use for control of how tracing state propagates across threads.
 */
public Builder(ServerClientAndLocalSpanState state) {
  this.state = Util.checkNotNull(state, "state must be specified.");
  this.localEndpoint = state.endpoint();
  // the legacy span state doesn't support nested spans per (#166). Only permit nesting on the span
  // state that has instructions on how to use it properly
  this.allowNestedLocalSpans = state instanceof InheritableServerClientAndLocalSpanState;
}

代码示例来源:origin: io.zipkin.brave/brave-core

@Override public void report(zipkin.Span span) {
  checkNotNull(span, "Null span");
  if (logger.isLoggable(Level.INFO)) {
   logger.info(span.toString());
  }
 }
}

代码示例来源:origin: io.zipkin.brave/brave-core

@Override
public void collect(Span span) {
 checkNotNull(span, "Null span");
 delegate.collect(span);
}

代码示例来源:origin: com.palantir.remoting/brave-extensions

@Override
public void collect(Span span) {
  Util.checkNotNull(span, "span must not be null");
  for (BinaryAnnotation ba : annotations) {
    span.addToBinary_annotations(ba);
  }
  log.info("{}", span);
}

代码示例来源:origin: io.zipkin.brave/brave-core

/**
 * @param endpoint Endpoint of the local service being traced.
 */
public ThreadLocalServerClientAndLocalSpanState(Endpoint endpoint) {
  Util.checkNotNull(endpoint, "endpoint must be specified.");
  Util.checkNotBlank(endpoint.service_name, "Service name must be specified.");
  this.endpoint = endpoint;
}

代码示例来源:origin: com.github.kristofa/brave-core

BinaryAnnotation(String key, byte[] value, AnnotationType type, @Nullable Endpoint host) {
 this.key = checkNotBlank(key, "Null or blank key");
 this.value = checkNotNull(value, "Null value");
 this.type = type;
 this.host = host;
}

代码示例来源:origin: io.zipkin.brave/brave-core

BinaryAnnotation(String key, byte[] value, AnnotationType type, @Nullable Endpoint host) {
 this.key = checkNotBlank(key, "Null or blank key");
 this.value = checkNotNull(value, "Null value");
 this.type = type;
 this.host = host;
}

相关文章

微信公众号

最新文章

更多