Class NamedThreadLocal<T>
java.lang.Object
java.lang.ThreadLocal<T>
org.springframework.core.NamedThreadLocal<T>
- Type Parameters:
- T- the value type
ThreadLocal subclass that exposes a specified name
 as toString() result (allowing for introspection).- Since:
- 2.5.2
- Author:
- Juergen Hoeller, Qimiao Chen
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionNamedThreadLocal(String name) Create a new NamedThreadLocal with the given name.
- 
Method SummaryModifier and TypeMethodDescriptiontoString()static <S> ThreadLocal<S> withInitial(String name, Supplier<? extends S> supplier) Create a named thread local variable.Methods inherited from class java.lang.ThreadLocalget, initialValue, remove, set, withInitial
- 
Constructor Details- 
NamedThreadLocalCreate a new NamedThreadLocal with the given name.- Parameters:
- name- a descriptive name for this ThreadLocal
 
 
- 
- 
Method Details- 
toString
- 
withInitialCreate a named thread local variable. The initial value of the variable is determined by invoking thegetmethod on theSupplier.- Type Parameters:
- S- the type of the named thread local's value
- Parameters:
- name- a descriptive name for the thread local
- supplier- the supplier to be used to determine the initial value
- Returns:
- a new named thread local
- Since:
- 6.1
 
 
-