Package com.jk.core.thread
Class JKThreadLocal
java.lang.Object
com.jk.core.thread.JKThreadLocal
This class is used for managing thread-local data using a 
ThreadLocal
 instance.- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionget()This method gets the thread-local map associated with the current thread.static ObjectThis method gets the value associated with the specified name from the thread-local map.static ObjectThis method gets the value associated with the specified name from the thread-local map, or returns the default value if not found.static voidThis method puts all of the mappings from the specified map to the thread-local map.static voidremove()This method removes the thread-local map associated with the current thread.static voidThis method sets the thread-local map to the provided map.static voidThis method sets the value associated with the specified name in the thread-local map. 
- 
Constructor Details
- 
JKThreadLocal
public JKThreadLocal() 
 - 
 - 
Method Details
- 
put
This method puts all of the mappings from the specified map to the thread-local map.- Parameters:
 map- Specifies the map whose values to copy.
 - 
get
This method gets the thread-local map associated with the current thread. If no such map exists, a new map is created.- Returns:
 - the thread-local map associated with the current thread.
 
 - 
getValue
This method gets the value associated with the specified name from the thread-local map.- Parameters:
 name- Specifies the name of the value to retrieve.- Returns:
 - the value associated with the specified name, or 
nullif not found. 
 - 
getValue
This method gets the value associated with the specified name from the thread-local map, or returns the default value if not found.- Parameters:
 name- Specifies the name of the value to retrieve.defaultValue- Specifies the default value to return if the specified name is not found.- Returns:
 - the value associated with the specified name, or the default value if not found.
 
 - 
remove
public static void remove()This method removes the thread-local map associated with the current thread. - 
set
This method sets the thread-local map to the provided map.- Parameters:
 map- Specifies the map to set as the thread-local map.
 - 
setValue
This method sets the value associated with the specified name in the thread-local map.- Parameters:
 name- Specifies the name of the value to set.attribute- Specifies the value to associate with the specified name.
 
 -