public class ClassLoaderThreadLocal<T> extends Object implements IClassLoaderCacheStateListener
Constructor and Description |
---|
ClassLoaderThreadLocal() |
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns the value in the current thread's copy of this thread-local variable within the
context class loader.
|
protected T |
initialValue()
Returns the current thread's "initial value" for this thread-local variable.
|
void |
onClassLoaderRemoved(Long classLoaderKey,
boolean explicit) |
void |
set(T value)
Sets the current thread's copy of this thread-local variable within the context class loader
to the specified value.
|
protected T initialValue()
get()
method,
unless the thread previously invoked the set(T)
method, in which case the
initialValue method will not be invoked for the thread. Normally, this method is
invoked at most once per thread, but it may be invoked again in case of subsequent
invocations of #remove
followed by get()
.
This implementation simply returns null; if the programmer desires thread-local variables to have an initial value other than null, ThreadLocal must be subclassed, and this method overridden. Typically, an anonymous inner class will be used.
public T get()
initialValue()
method.public void set(T value)
initialValue()
method to set the values of thread-locals.value
- the value to be stored in the current thread's copy of this thread-local.public void onClassLoaderRemoved(Long classLoaderKey, boolean explicit)
onClassLoaderRemoved
in interface IClassLoaderCacheStateListener
Copyright © GigaSpaces.