public final class ThreadContext extends 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 and Description |
---|---|
static void |
clear()
Removes all existing values from thread context.
|
static String |
get(String key)
Gets a value by key from thread context.
|
static Map<String,String> |
getMapping()
Gets all values that are visible for the current thread from thread context.
|
static void |
put(String key,
Object value)
Stores a value in thread context.
|
static void |
remove(String key)
Removes a value from thread context.
|
public static Map<String,String> getMapping()
The returned map is either read-only or a mutable copy. It cannot used to modify the thread context itself.
public static String get(String key)
key
- Key of mappingnull
public static void put(String key, Object value)
key
- Key of mappingvalue
- Value of mappingpublic static void remove(String key)
key
- Key of mappingpublic static void clear()
Copyright © 2024. All rights reserved.