ThreadLocal subclass that exposes a specified name
as toString() result (allowing for introspection).
NamedInheritableThreadLocal
| Modifier and Type | Class and Description |
|---|---|
| private static class | NamedThreadLocal.SuppliedNamedThreadLocal<
the type of the named thread local's value T>An extension of NamedThreadLocal that obtains its initial value from
the specified |
| Access | Constructor and Description |
|---|---|
| public | NamedThreadLocal(String
a descriptive name for this ThreadLocal name)Create a new NamedThreadLocal with the given name. |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public static < the type of the named thread local's value S> ThreadLocal | Returns: a new named thread locala descriptive name for the thread local name, Supplier<? extends S> the supplier to be used to determine the initial value supplier)Create a named thread local variable. |
| name | back to summary |
|---|---|
| private final String name | |
| NamedThreadLocal | back to summary |
|---|---|
| public NamedThreadLocal(String name) Create a new NamedThreadLocal with the given name.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| withInitial | back to summary |
|---|---|
| public static <S> ThreadLocal Create a named thread local variable. The initial value of the variable is
determined by invoking the
| |
Supplier.
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected T | initialValue()
Overrides java. |
| supplier | back to summary |
|---|---|
| private final Supplier<? extends T> supplier | |
| SuppliedNamedThreadLocal | back to summary |
|---|---|
| pack-priv SuppliedNamedThreadLocal(String name, Supplier<? extends T> supplier) | |
| initialValue | back to summary |
|---|---|
| protected T initialValue() Overrides java. Doc from java. Returns the current thread's "initial value" for this
thread-local variable. This method will be invoked the first
time a thread accesses the variable with the
| |