...
Wiki Markup |
---|
This vulnerability can be prevented using a {{java.lang.Object}} declared {{private}} and {{final}} within the class. The object must be used explicitly for locking purposes in {{synchronized}} blocks within the classâs methods. This intrinsic lock is associated with the instance of the private object and not the class. Consequently, there is no lock contention between this classâs methods and the methods of a hostile class. Bloch refers to this technique as the âprivate lock objectâ idiom \[[Bloch 012001|AA. Java References#Bloch 01]\]. |
...
References
Wiki Markup |
---|
\[[Bloch 012001|AA. Java References#Bloch 01]\] Item 52: "Document Thread Safety" |
...