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
get set
public Object get()
public void set(Object o)
These functions set/get a thread-local value for this object.
Reference:
Summary
We described the basic design of thread-specific data storage, its use, and some of the
implementation details.
Search WWH :