T - The type of the elements in the inheritable thread local stack.@ThreadSafe public final class InheritableThreadLocalStack<T> extends Object
Stack, except that
each call is forwarded to a private InheritableThreadLocal object.
Whenever a child thread gets started, it will share the same top level element of the parent's inheritable thread local stack unless the parent's inheritable thread local stack is empty.
| Constructor and Description |
|---|
InheritableThreadLocalStack() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty() |
T |
peek() |
T |
peekOrElse(T elze)
Returns the top element on this stack unless it's
null, in which
case elze gets returned. |
T |
pop() |
void |
popIf(T expected)
Pops the top element off this stack if its identical to the given
element.
|
T |
push(T element)
Pushes the given element onto this stack.
|
public boolean isEmpty()
@Nullable public T peekOrElse(@Nullable T elze)
null, in which
case elze gets returned.elze - The default element.null,
in which case elze gets returned.public void popIf(@Nullable T expected)
expected - The expected top element on this stack.IllegalStateException - If the given element is not the top
element on this stack.Copyright © 2005-2012 Schlichtherle IT Services. All Rights Reserved.