Package uk.org.lidalia.lang
Class ThreadLocal<T>
- java.lang.Object
-
- uk.org.lidalia.lang.ThreadLocal<T>
-
- Type Parameters:
T- the type of the thread local variable
public class ThreadLocal<T> extends Object
This class was written by Robert Elliot and is originally located at https://github.com/Mahoney/lidalia-langA ThreadLocal that has no
ClassLoaderleaks associated with it and does not permit null.
-
-
Constructor Summary
Constructors Constructor Description ThreadLocal(Supplier<T> initialValueCreator)ThreadLocal(T initialValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<T>allValues()Tget()voidremove()Removes the value for the callingThread.voidreset()Removes the values for ALLThreads.voidset(T value)
-
-
-
Constructor Detail
-
ThreadLocal
public ThreadLocal(T initialValue)
-
-
Method Detail
-
set
public void set(T value)
-
get
public T get()
- Returns:
- the value for the calling
Thread, or the initial value if this has not been set or has been removed.
-
remove
public void remove()
-
reset
public void reset()
-
allValues
public Collection<T> allValues()
-
-