|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ThreadLocal<T>
public class ThreadLocal<T>
ThreadLocal provides thread local variables, i.e., variables for which each thread that uses them has its own private copy.
Constructor Summary | |
---|---|
ThreadLocal()
Constructor to create a thread local variable. |
Method Summary | |
---|---|
T |
get()
get returns the current value in the current' threads local instance of this thread local variable. |
protected T |
initialValue()
initialValue returns an initial value for this variable. |
void |
remove()
Remove this thread local variable (from current thread or from all threads?), reset value to initialValue. |
void |
set(T value)
set sets the current thread's value of this thread local variable to the given value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThreadLocal()
For JamaicaVM: Please note that the ThreadLocal instance must be assignable to all thread instances of threads that use this thread local variable. I.e., if the instance of ThreadLocal is allocated in ScopedMemory s1, all threads using this instance must have their thread object allocated in the same or an inner scope of s1.
Method Detail |
---|
protected T initialValue()
The default initial value is null.
For JamaicaVM: Please note that the initial value must be assignable to all thread instances of threads that use this thread local variable. I.e., if the initial value is allocated in ScopedMemory s1, all threads using this instance must have their thread object allocated in the same or an inner scope of s1.
public T get()
public void set(T value)
For JamaicaVM: Please note that the value must be assignable to the current thread instance. I.e., if the value is allocated in ScopedMemory s1, then the current thread must have its thread object allocated in the same or an inner scope of s1.
ensures
(get() == value);
value
- the new value for this variablepublic void remove()
|
![]() |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |