public final class ThreadContext
extends java.lang.Object
If values will be stored by a thread from a thread pool, clear()
should be called before putting the thread
back to the pool.
Modifier and Type | Method | Description |
---|---|---|
static void |
clear() |
Removes all existing values from thread context.
|
static java.lang.String |
get(java.lang.String key) |
Gets a value by key from thread context.
|
static java.util.Map<java.lang.String,java.lang.String> |
getMapping() |
Gets all values that are visible for the current thread from thread context.
|
static void |
put(java.lang.String key,
java.lang.Object value) |
Stores a value in thread context.
|
static void |
remove(java.lang.String key) |
Removes a value from thread context.
|
public static java.util.Map<java.lang.String,java.lang.String> getMapping()
The returned map is either read-only or a mutable copy. It cannot used to modify the thread context itself.
public static java.lang.String get(java.lang.String key)
key
- Key of mappingnull
public static void put(java.lang.String key, java.lang.Object value)
key
- Key of mappingvalue
- Value of mappingpublic static void remove(java.lang.String key)
key
- Key of mappingpublic static void clear()
Copyright © 2019. All rights reserved.