img
. .
MyThread.runnable.set(r);
}
}
APIs Used in This Chapter
The Class java.lang.ThreadLocal
This class implements thread local storage by defining an object that can hold different values for
different threads.
ThreadLocal
public ThreadLocal()
This creates a new thread local object.
Reference
Chapter 8.
get set
public Object get()
public void set(Object o)
These functions set/get a thread-local value for this object.
Reference:
Chapter 8.
Summary
We described the basic design of thread-specific data storage, its use, and some of the
implementation details.
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home