类 NamedThreadLocal<T>

java.lang.Object
java.lang.ThreadLocal<T>
cn.taketoday.core.NamedThreadLocal<T>
类型参数:
T - the value type

public class NamedThreadLocal<T> extends ThreadLocal<T>
ThreadLocal subclass that exposes a specified name as toString() result (allowing for introspection).
从以下版本开始:
3.0
作者:
Juergen Hoeller, TODAY 2021/2/1 20:43
  • 构造器详细资料

    • NamedThreadLocal

      public NamedThreadLocal(String name)
      Create a new NamedThreadLocal with the given name.
      参数:
      name - a descriptive name for this ThreadLocal
  • 方法详细资料

    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • withInitial

      public static <S> NamedThreadLocal<S> withInitial(String name, Supplier<? extends S> supplier)
      Creates a thread local variable. The initial value of the variable is determined by invoking the get method on the Supplier.
      类型参数:
      S - the type of the thread local's value
      参数:
      name - a descriptive name for this ThreadLocal
      supplier - the supplier to be used to determine the initial value
      返回:
      a new thread local variable
      抛出:
      NullPointerException - if the specified supplier is null
      从以下版本开始:
      4.0