public class JDKThreadLocal<T> extends ContextLocalBase<T> implements ContextLocal<T>
ContextLocal
using
JDK ThreadLocalContextLocal.Factory, ContextLocal.InitialValueProvider<T>
CONF_CONTEXT_LOCAL_FACTORY
Constructor and Description |
---|
JDKThreadLocal() |
JDKThreadLocal(ContextLocal.InitialValueProvider<T> ivp) |
Modifier and Type | Method and Description |
---|---|
T |
get()
Returns the value in the current context's copy of this
context-local variable.
|
void |
remove()
Removes the current context's value for this context-local
variable.
|
void |
set(T value)
Sets the current context's copy of this context-local variable
to the specified value.
|
initialValue
apply
breakOut
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
initialValue
public JDKThreadLocal()
public JDKThreadLocal(ContextLocal.InitialValueProvider<T> ivp)
public T get()
ContextLocal
ContextLocal.initialValue()
method.get
in interface ContextLocal<T>
public void set(T value)
ContextLocal
ContextLocal.initialValue()
method to set the values of context-locals.set
in interface ContextLocal<T>
value
- the value to be stored in the current context's copy of
this context-local.public void remove()
ContextLocal
ContextLocal.initialValue()
method,
unless its value is set by the current context
in the interim. This may result in multiple invocations of the
initialValue method in the current context.remove
in interface ContextLocal<T>
Copyright © 2017. All Rights Reserved.