aspose file tools*
The moose likes Threads and Synchronization and the fly likes Thread local Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Thread local" Watch "Thread local" New topic
Author

Thread local

jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
in which scenario ,Thread local can be used?.please give some real time examplae
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Right down the bottom of this article, "The benefits of ThreadLocal". It covers scenarios where they are useful.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
If you use storage then don't forget to do the cleanup.


My Blog
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3275
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 ]

500+ Java Interview Questions and Answers | Java job hunting know how & Java resumes
jacob deiter
Ranch Hand

Joined: Apr 02, 2008
Posts: 576
Hi Arul

Thank you for your reply.

[ September 30, 2008: Message edited by: jacob deiter ]
[ October 01, 2008: Message edited by: jacob deiter ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread local