public interface ThreadContextStack extends Collection<String>, Serializable
| Modifier and Type | Interface and Description |
|---|---|
static class |
ThreadContextStack.EmptyIterator<E> |
static class |
ThreadContextStack.EmptyThreadContextStack
An empty read-only ThreadContextStack.
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
asList()
Returns all the elements in the stack in a List.
|
ThreadContextStack |
copy()
Returns a copy of the ContextStack.
|
int |
getDepth()
Returns the number of elements in the stack.
|
ThreadContextStack |
getImmutableStackOrNull()
Returns a ContextStack with the same contents as this ContextStack or
null. |
String |
peek()
Returns the element at the top of the stack without removing it or null if the stack is empty.
|
String |
pop()
Returns the element at the top of the stack.
|
ThreadContext.StoredContext |
preserveContext()
preserve thread context map and set default context
|
void |
push(String message)
Pushes an element onto the stack.
|
ThreadContext.StoredContext |
storeContext()
preserve thread context map without default context
|
void |
trim(int depth)
Trims elements from the end of the stack.
|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayThreadContext.StoredContext preserveContext()
ThreadContext.StoredContext storeContext()
String pop()
NoSuchElementException - if the stack is empty.String peek()
void push(String message)
message - The element to add.int getDepth()
List<String> asList()
void trim(int depth)
depth - The maximum number of items in the stack to keep.ThreadContextStack copy()
ThreadContextStack getImmutableStackOrNull()
null. Attempts to modify the
returned stack may or may not throw an exception, but will not affect the contents of this ContextStack.null.Copyright © 2022. All rights reserved.