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

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

本文整理了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

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

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

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

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

  1. SpanId(Builder builder) {
  2. checkNotNull(builder.spanId, "spanId");
  3. this.traceIdHigh = builder.traceIdHigh;
  4. this.traceId = builder.traceId != null ? builder.traceId : builder.spanId;
  5. this.parentId = builder.nullableParentId != null ? builder.nullableParentId : this.traceId;
  6. this.spanId = builder.spanId;
  7. this.flags = builder.flags;
  8. }

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

  1. /**
  2. * Creates a new instance.
  3. *
  4. * @param wrappedExecutor Wrapped ExecutorService to which execution will be delegated.
  5. * @param threadBinder Thread binder.
  6. */
  7. public BraveExecutorService(final ExecutorService wrappedExecutor, final ServerSpanThreadBinder threadBinder) {
  8. this.wrappedExecutor = checkNotNull(wrappedExecutor, "Null wrappedExecutor");
  9. this.threadBinder = checkNotNull(threadBinder, "Null threadBinder");
  10. }

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

  1. /**
  2. * Creates a new instance.
  3. *
  4. * @param state local span state, cannot be <code>null</code>
  5. */
  6. public LocalSpanThreadBinder(LocalSpanState state) {
  7. this.state = checkNotNull(state, "state");
  8. }

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

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

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

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

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

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

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

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

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

  1. public static String checkNotBlank(String string, String errorMessageTemplate,
  2. Object... errorMessageArgs) {
  3. if (checkNotNull(string, errorMessageTemplate, errorMessageArgs).trim().isEmpty()) {
  4. throw new IllegalArgumentException(format(errorMessageTemplate, errorMessageArgs));
  5. }
  6. return string;
  7. }

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

  1. BraveExecutorService(ExecutorService wrappedExecutor, Brave brave) { // intentionally hidden
  2. this.wrappedExecutor = checkNotNull(wrappedExecutor, "wrappedExecutor");
  3. checkNotNull(brave, "brave");
  4. this.localSpanThreadBinder = brave.localSpanThreadBinder();
  5. this.serverSpanThreadBinder = brave.serverSpanThreadBinder();
  6. }

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

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

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

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

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

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

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

  1. @Override public void report(zipkin.Span span) {
  2. checkNotNull(span, "Null span");
  3. if (logger.isLoggable(Level.INFO)) {
  4. logger.info(span.toString());
  5. }
  6. }
  7. }

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

  1. @Override
  2. public void collect(Span span) {
  3. checkNotNull(span, "Null span");
  4. delegate.collect(span);
  5. }

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

  1. @Override
  2. public void collect(Span span) {
  3. Util.checkNotNull(span, "span must not be null");
  4. for (BinaryAnnotation ba : annotations) {
  5. span.addToBinary_annotations(ba);
  6. }
  7. log.info("{}", span);
  8. }

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

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

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

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

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

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

相关文章