Methods that can both modify a static field and be invoked from untrusted code must synchronize access to the static field. Even when client-side locking is a specified requirement of the method, untrusted clients can fail to synchronize (whether inadvertently or maliciously). Because the static field is shared by all clients, untrusted clients may violate the contract by failing to provide suitable locking.
According to Joshua Bloch \ [[Bloch 2008|AA. References#Bloch 08]\] Wiki Markup
If a method modifies a static field, you must synchronize access to this field, even if the method is typically used only by a single thread. It is not possible for clients to perform external synchronization on such a method because there can be no guarantee that unrelated clients will do likewise.
...
Bibliography
...
[[API 2006AA. 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="9ca9fdb7-e754-4f6d-83fc-3633fbb2f7eb"><ac:plain-text-body><![CDATA[ |
[[Bloch 2008AA. References#Bloch 08]] | Item 67. Avoid excessive synchronization ]]></ac:plain-text-body></ac:structured-macro> |
...