Java Reference
In-Depth Information
Listing 14.6. Bounded Buffer Using Condition Queues.
BoundedBuffer is finally good enough to use—it is easy to use and manages state de-
pendence sensibly. [6] A production version should also include timed versions of put and
take , so that blocking operations can time out if they cannot complete within a time budget.
The timed version of Object.wait makes this easy to implement.
14.2. Using Condition Queues
Condition queues make it easier to build efficient and responsive state-dependent classes, but
they are still easy to use incorrectly; there are a lot of rules regarding their proper use that are
not enforced by the compiler or platform. (This is one of the reasons to build on top of classes
Search WWH ::




Custom Search