Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added verbiage disclaiming synchronizedList in CS

...

This code does not violate rule LCK04-J. Do not synchronize on a collection view if the backing collection is accessible because, while it does synchronize on a collection view (the synchronizedList), the backing collection is inaccessible and consequently cannot be modified by any code.

Note that this compliant solution does not actually use the synchronization offered by Collections.synchronizedList(). If no other code in this solution used it, it could be removed, with ips being a direct ArrayList.

Noncompliant Code Example (synchronizedMap())

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="9166b19a3ac6d275-2748fff7-422540cb-941dae9f-41cdd2094e960a7af57af8ba"><ac:plain-text-body><![CDATA[

[[API 2006

AA. Bibliography#API 06]]

 

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="d3c9158ce4525697-091a9aab-4a854a91-8880b412-5c0eed8fec81572b8d8bde66"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. Bibliography#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="8f6a5beb2f86b0f9-31131811-40d34a95-b90a9349-1b37deebc69ea290a15b0eaf"><ac:plain-text-body><![CDATA[

[[JavaThreads 2004

AA. Bibliography#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="13079ceb3cc49a7e-e21a6821-47974e2d-a527a6d8-491e874bd466c7545a63b800"><ac:plain-text-body><![CDATA[

[[Lee 2009

AA. Bibliography#Lee 09]]

"Map & Compound Operation"

]]></ac:plain-text-body></ac:structured-macro>

...