Thread-local is a class from the Java API and the documentation defines it: "This class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own, independently initialized copy of the variable. ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread (e.g., a user ID or Transaction ID)."
This is a class from the Java API and the documentation defines it this way:
This class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own, independently initialized copy of the variable. ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread (e.g., a user ID or Transaction ID)."
What questions should have this tag?
- Questions that deal with the concept of thread-local directly.
- Questions dealing with design-patterns based on using this class.
- Questions which have issues while using this class.
Useful Links
- Official Documentation
- A short tutorial on Thread Local
- How to shoot yourself in foot with ThreadLocals Introduction to java ThreadLocal storage