Chapter 2. Exclusion
In a safe system, every object protects itself from integrity violations. This sometimes requires the cooperation of other objects and their methods.
Exclusion techniques preserve object invariants and avoid effects that would result from acting upon even momentarily inconsistent state representations. Programming techniques and design patterns achieve exclusion by preventing multiple threads from concurrently modifying or acting upon object representations. All approaches rely on one or more of three basic strategies:
Eliminating the need for some or all exclusion control by ensuring that methods never modify an object's representation, so that the object cannot enter inconsistent states.
Dynamically ensuring that only one thread ...
Get Concurrent Programming in Java™: Design Principles and Patterns, Second 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.