Enum ThreadLocalContextStorage

java.lang.Object
java.lang.Enum<ThreadLocalContextStorage>
io.opentelemetry.context.ThreadLocalContextStorage
All Implemented Interfaces:
ContextStorage, Serializable, Comparable<ThreadLocalContextStorage>, java.lang.constant.Constable

enum ThreadLocalContextStorage extends Enum<ThreadLocalContextStorage> implements ContextStorage
  • Enum Constant Details

  • Field Details

    • logger

      private static final Logger logger
    • THREAD_LOCAL_STORAGE

      private static final ThreadLocal<Context> THREAD_LOCAL_STORAGE
  • Constructor Details

    • ThreadLocalContextStorage

      private ThreadLocalContextStorage()
  • Method Details

    • values

      public static ThreadLocalContextStorage[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ThreadLocalContextStorage valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • attach

      public Scope attach(Context toAttach)
      Description copied from interface: ContextStorage
      Sets the specified Context as the current Context and returns a Scope representing the scope of execution. Scope.close() must be called when the current Context should be restored to what it was before attaching toAttach.
      Specified by:
      attach in interface ContextStorage
    • current

      @Nullable public Context current()
      Description copied from interface: ContextStorage
      Returns the current Context. If no Context has been attached yet, this will return null.
      Specified by:
      current in interface ContextStorage