It's not a secret anymore!
The moose likes Java in General and the fly likes ThreadLocal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "ThreadLocal" Watch "ThreadLocal" New topic


Cory Wilkerson
Ranch Hand

Joined: Aug 14, 2001
Posts: 84
Looking to clarify here:

If threads foo, bar, and fizzle all create instances of class X -- can I simply call: X.local.get() (from the context of each thread) and be returned the long associated with "local" when the X instance was created?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24193

Yes, that's right.
[ July 11, 2003: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: ThreadLocal
jQuery in Action, 3rd edition