T - Value typepublic class TryThreadLocal<T> extends ThreadLocal<T>
| Modifier and Type | Class and Description |
|---|---|
static interface |
TryThreadLocal.Memo
Remembers to set the value back.
|
| Modifier and Type | Field and Description |
|---|---|
private T |
initialValue |
| Modifier | Constructor and Description |
|---|---|
private |
TryThreadLocal(T initialValue) |
| Modifier and Type | Method and Description |
|---|---|
protected T |
initialValue() |
static <T> TryThreadLocal<T> |
of(T initialValue)
Creates a TryThreadLocal.
|
TryThreadLocal.Memo |
push(T value)
Assigns the value as
value for the current thread. |
get, remove, set, withInitialprivate final T initialValue
private TryThreadLocal(T initialValue)
public static <T> TryThreadLocal<T> of(T initialValue)
initialValue - Initial valueprotected final T initialValue()
initialValue in class ThreadLocal<T>public TryThreadLocal.Memo push(T value)
value for the current thread.
Returns a TryThreadLocal.Memo which, when closed, will assign the value
back to the previous value.Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.