In a webapp, I have a scenario where I need some kind of global context (Static like) for few variables, for the current thread only.
If there are 3 different concurrent users, then I expect three corresponding global context variable for the 3 separate threads/sessions.
Using a Static variable makes its scope global for all the threads.
Is there a way in which I can achieve this?
requests
. Thanks for the correction and insight!ThreadLocal
, pretty basic construct in Java, explained in tutorials for beginners