public static class CloseableThreadContext.Instance extends Object implements AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close()
Removes the values from the
ThreadContext . |
CloseableThreadContext.Instance |
push(String message)
Pushes new diagnostic context information on to the Thread Context Stack.
|
CloseableThreadContext.Instance |
push(String message,
Object[] args)
Pushes new diagnostic context information on to the Thread Context Stack.
|
CloseableThreadContext.Instance |
pushAll(List<String> messages)
Populates the Thread Context Stack with the supplied stack.
|
CloseableThreadContext.Instance |
put(String key,
String value)
Populates the Thread Context Map with the supplied key/value pair.
|
CloseableThreadContext.Instance |
putAll(Map<String,String> values)
Populates the Thread Context Map with the supplied key/value pairs.
|
public CloseableThreadContext.Instance push(String message)
message
- The new diagnostic context information.public CloseableThreadContext.Instance push(String message, Object[] args)
message
- The new diagnostic context information.args
- Parameters for the message.public CloseableThreadContext.Instance put(String key, String value)
ThreadContext
will be replaced with the supplied value, and restored back to their original value when
the instance is closed.key
- The key to be addedvalue
- The value to be addedpublic CloseableThreadContext.Instance putAll(Map<String,String> values)
ThreadContext
will be replaced with the supplied values, and restored back to their original value when
the instance is closed.values
- The map of key/value pairs to be addedpublic CloseableThreadContext.Instance pushAll(List<String> messages)
messages
- The list of messages to be addedpublic void close()
ThreadContext
.
Values pushed to the ThreadContext
stack will be popped off.
Values put on the ThreadContext
map will be removed, or restored to their original values it they already existed.
close
in interface AutoCloseable
Copyright © 1999-1969 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.