Product Documentation : Ehcache Developer Guide : Using Explicit Locking : How Locking Works
How Locking Works
A READ lock does not prevent other READers from also acquiring a READ lock and reading. A READ lock cannot be obtained if there is an outstanding WRITE lock. It will queue.
A WRITE lock cannot be obtained while there are outstanding READ locks. It will queue.
In each case the lock should be released after use to avoid locking problems. The lock release should be in a "finally" block.
If before each read you acquire a READ lock and then before each write you acquire a WRITE lock, then an isolation level akin to READ_COMMITTED is achieved.
Copyright © 2010-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product Logo |   Feedback