T
- the type of the thread local variablepublic class ThreadLocal<T> extends Object
A ThreadLocal that has no ClassLoader
leaks associated with it and does not permit
null.
Constructor and Description |
---|
ThreadLocal(Supplier<T> initialValueCreator) |
ThreadLocal(T initialValue) |
Modifier and Type | Method and Description |
---|---|
Collection<T> |
allValues() |
T |
get() |
void |
remove()
Removes the value for the calling
Thread . |
void |
reset()
Removes the values for ALL
Thread s. |
void |
set(T value) |
public ThreadLocal(T initialValue)
public void set(T value)
public T get()
Thread
, or the initial value if this has not been set
or has been removed.public void remove()
public void reset()
public Collection<T> allValues()
Copyright © 2023. All rights reserved.