• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread local

 
jacob deiter
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in which scenario ,Thread local can be used?.please give some real time examplae
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right down the bottom of this article, "The benefits of ThreadLocal". It covers scenarios where they are useful.
 
Vinod K Singh
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use storage then don't forget to do the cleanup.
 
arulk pillai
Author
Ranch Hand
Posts: 3387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ThreadLocal is a handy class for simplifying development of thread-safe concurrent programs by making the object stored in this class not sharable between threads. ThreadLocal class encapsulates non-thread-safe classes to be safely used in a multi-threaded environment and also allows you to create per-thread-singleton. A typical example would be:



[ September 30, 2008: Message edited by: arulk pillai ]
 
jacob deiter
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arul

Thank you for your reply.

[ September 30, 2008: Message edited by: jacob deiter ]
[ October 01, 2008: Message edited by: jacob deiter ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic