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 |
put(String key,
String value)
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 values, and restored back to their original values when
the instance is closed.key
- The key to be addedvalue
- The value 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-2016 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.