Java Reference
In-Depth Information
R EFACTORED SOLUTION NAME : Read / Write Locks.
R EFACTORED SOLUTION TYPE : Software.
R EFACTORED SOLUTION DESCRIPTION : Instead of synchronizing on
methods or objects, use a read / write lock. As of the publishing date, Java
had not yet included a read / write lock, but many examples exist in litera-
ture and on the Internet.
R OOT CAUSES : Ignorance. Java does not yet include a read / write lock, and
information about this solution is not widely distributed.
S YMPTOMS , CONSEQUENCES : This antipattern must usually be detected
by inspection, but occasionally a web application server can bog down
without fully using available CPU resources.
S OLUTION A LTERNATIVES : A second solution for this problem is called
Copy-on-Write. This solution involves creating a copy of a cache item,
locking the copy, writing to the copy, and then deleting the original.
Readers in this scenario do not lock.
Search WWH ::




Custom Search