Synchronizing Object Access
- To solve problems such as the one just seen, use a lock object
- A lock object is used to control threads that manipulate shared resources
- In Java: Lock interface and several classes that implement it
- ReentrantLock: most commonly used lock class
- Locks are a feature of Java version 5.0
- Earlier versions of Java have a lower-level facility for thread synchronization