...
Given an invariant involving multiple objects, a programmer might incorrectly assume that a group of individually atomic operations is collectively atomic without additional locking. Similarly, programmers might incorrectly assume that use of a thread-safe Collection is sufficient to preserve an invariant that involves the collection's elements without additional synchronization. A thread-safe class can only guarantee atomicity of its individual methods. A grouping of calls to such methods requires additional synchronization for the group.
Consider, for example, a scenario where the standard thread-safe API lacks a single method to both find a particular person's record in a Hashtable and also update that person's payroll information. In such cases, the two method invocations must be performed atomically.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4a565d89b95a84c3-267c5a0f-41a94c63-b16bbe47-d72a1d2cdf07ed15690dc0bb"><ac:plain-text-body><![CDATA[ | [[API 2006 | AA. References#API 06]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="022d791ceaf23d32-ddeba301-41c94d29-bd758b14-0f8c9e8d0ab8d68e9997bf4d"><ac:plain-text-body><![CDATA[ | [[Goetz 2006 | AA. References#Goetz 06]] | Section 4.4.1, Client-side Locking | ]]></ac:plain-text-body></ac:structured-macro> |
| Section 5.2.1, ConcurrentHashMap | |||
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="06e7bd8ea7e69a97-cccc640f-42b547d8-b9aab8e5-f293dcf959ae478926a1cda6"><ac:plain-text-body><![CDATA[ | [[JavaThreads 2004 | AA. References#JavaThreads 04]] | Section 8.2, Synchronization and Collection Classes | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7ce2922e591aae49-13bd96e2-47754f7d-96f0bf96-823407ba8539f1153e77e5ec"><ac:plain-text-body><![CDATA[ | [[Lee 2009 | AA. References#Lee 09]] | Map & Compound Operation | ]]></ac:plain-text-body></ac:structured-macro> |
...