threadlocal « concurrency « Java Thread Q&A

Home
Java Thread Q&A
1.concurrency
2.Development
3.Exception
4.Notify
5.Operation
6.Socket
7.State
8.synchronize
9.Thread Safe
10.ThreadPool
Java Thread Q&A » concurrency » threadlocal 

1. When and how should I use a ThreadLocal variable?    stackoverflow.com

When should I use a ThreadLocal variable? How is it used?

2. ThreadLocals hard to use    stackoverflow.com

I'm using ThreadLocal variables (through Clojure's vars, but the following is the same for plain ThreadLocals in Java) and very often run into the issue that I can't be sure that ...

3. Do I need to call ThreadLocal.remove in the following case    stackoverflow.com

Instead of writing the following non-thread safe method.

private static final Calendar calendar = Calendar.getInstance();
public void fun() {
    // Going to call mutable methods in calendar.
}

I change it to ...

4. Thread-local object pooling    stackoverflow.com

Going through the Goetz "Java Concurrency in Practice" book, he makes a case against using object pooling (section 11.4.7) - main arguments: 1) allocation in Java is faster than C's malloc 2) threads ...

5. Sharing a ThreadLocal variable in Java    stackoverflow.com

In my small application I have threads of two classes - basically writers and readers. Multiple readers can be assigned to a single writer. A writer interacts with its readers by ...

6. Is there any benefit in puting a ThreadSafe object on a ThreadLocal?    stackoverflow.com

I recently saw a piece of code which used a ThreadLocal object and kept a ConcurrentHashMap within it. Is there any logic/benefit in this, or is it redundant?

7. Java Cached thread pool and thread local    stackoverflow.com

I have a question about java and concurrency. Let say I have a ThreadLocal variable called a. And I use a CachedThreadPool to obtain new threads. When a thread is rehused, what happends ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.