All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.javaagent.bootstrap.CallDepthThreadLocalMap Maven / Gradle / Ivy

There is a newer version: 2.11.0-alpha
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.javaagent.bootstrap;

final class CallDepthThreadLocalMap {

  private static final ClassValue TLS =
      new ClassValue() {
        @Override
        protected ThreadLocalDepth computeValue(Class type) {
          return new ThreadLocalDepth();
        }
      };

  static CallDepth getCallDepth(Class k) {
    return TLS.get(k).get();
  }

  private static final class ThreadLocalDepth extends ThreadLocal {
    @Override
    protected CallDepth initialValue() {
      return new CallDepth();
    }
  }

  private CallDepthThreadLocalMap() {}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy