• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is ThreadLocal  RSS feed

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have gone through the definition given at link
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ThreadLocal.html

can any one please Explain it, taking a different Example.
 
Rancher
Posts: 42972
73
 
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A ThreadLocal is basically little more than a variable that has different values for each thread. You can consider it as a Map<Thread,T> but always using the current thread as the key for get and put operations. ThreadLocal is inherently thread safe.
 
prakash pawar
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot Rob for QuickReply :-)
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!