Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Instances of classes that implement either or both of the Lock and Condition interfaces of the java.util.concurrent.locks package are known as high-level concurrency objects. Using the intrinsic locks of such objects is a questionable practice even in cases where the code may appear to function correctly. Consequently, programs that interact with such objects must use only the high-level locking facilities provided by the interfaces; use of the intrinsic locks is prohibited. This problem generally arises when code is refactored from intrinsic locking to the java.util.concurrent dynamic-locking utilities.

Noncompliant Code Example (ReentrantLock

...

)

The doSomething() method in this noncompliant code example synchronizes on the intrinsic lock of an instance of ReentrantLock rather than on the reentrant mutual exclusion Lock encapsulated by ReentrantLock.

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="13f1ce64b21d0987-64b8dc3f-41814ea9-8b959dce-622e91db2f8daca74944c463"><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="4b801f6f539ab51e-bca2b552-4b224f5d-9bb7aee4-bfeb17e387f629819b94d13f"><ac:plain-text-body><![CDATA[

[[Findbugs 2008

AA. Bibliography#Findbugs 08]]

 

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="84f20d271af0e344-81056e1d-40a1411e-9e00834a-53b151576d362799024db035"><ac:plain-text-body><![CDATA[

[[Pugh 2008

AA. Bibliography#Pugh 08]]

Synchronization

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="52ce7026990afdf2-7221bde1-41b5460c-92a680ae-52f33e6d3da9302dd0ffda4f"><ac:plain-text-body><![CDATA[

[[Miller 2009

AA. Bibliography#Miller 09]]

Locking

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

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="afb160c9b6be1b8c-a74454c9-404e478f-a267a4e4-34b71e99d29d25f264ce34f9"><ac:plain-text-body><![CDATA[

[[Tutorials 2008

AA. Bibliography#Tutorials 08]]

[Wrapper Implementations

http://java.sun.com/docs/books/tutorial/collections/implementations/wrapper.html]

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

...