Possible Duplicate:
When and how should I use a ThreadLocal variable?
What I know about thread local is .
1) Thread Local must be declared as public static final .
2) Thread Local is a Local Variable for current thread .
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
it doesn’t need to be public
but it is essentially a Map where you can only get for the current Thread as key and when the value hasn’t been set yet it is initialized automatically
this implements thread local storage so you can have “public static” variables without needing to synchronize on them