17.2. Wait Sets and Notification
Every object, in addition to having an associated monitor, has an associated wait set. A wait set is a set of threads.
When an object is first created, its wait set is empty. Elementary actions that add threads to and remove threads from wait sets are atomic. Wait sets are manipulated solely through the methods Object.wait
, Object.notify
, and Object.notifyAll
.
Wait set manipulations can also be affected by the interruption status of a thread, and by the Thread
class’s methods dealing with interruption. Additionally, the Thread
class’s methods for sleeping and joining other threads have properties derived from those of wait and notification actions.
17.2.1. Wait
Wait actions occur upon invocation of wait()
, or ...
Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.