| ||||
| Copyright 1999 Sams Publishing |
| | ||
| | |
| Summary |
| | |
| Threads can communicate and signal each other by several mechanisms in Java. The wait/notify mechanism ( wait() , notify() , and notifyAll() ) provides a multithread-safe way for one thread to signal another that a value has changed. I showed you that it is important to make sure to avoid missed notifications and early notifications. |
| | |
| In addition, threads can use the join() method of Thread to wait for other threads to die. A thread can also stream data through a pipe to another thread using the classes PipedInputStream , PipedOutputStream , PipedReader , and PipedWriter . |
| | |
| Threads can also use thread-specific variables that keep a different value for different threads by using the classes ThreadLocal and InheritableThreadLocal . |
| | | ||
| Toc | |||