Thread local variables is a useful concept in Java. I lately came across this when looking into Distributed Transaction capability in WSO2 Data Services Server (DSS).
Thread Local can be considered as a scope of access, like a request scope or session scope. It’s a thread scope. You can set any object in Thread Local and this object will be global and local to the specific thread which is accessing this object. Global and local!!? Here is a blog which explains it with an example.
Java Thread Local – How to use and code sample
Also this Stack-overflow question has good detail on what can be pit-falls etc.
No comments:
Post a Comment