|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.soton.ecs.grimoires.server.store.CopyOfReadWriteLock
A lock that allows multiple read access or single write access to some data at any one time. Reads are prioritised over writes so all reads are processed first. Before performing a read operation on the data in question, the client code should call beforeRead() on the associated lock, then call afterRead () afterwards. Similarly, before performing a write operation on the data, the client code should call beforeWrite() on the associated lock, then call afterWrite () afterwards.
This code is adapted from that in "Concurrent Programming in Java" by Doug Lea, published by Addison Wesley.
| Constructor Summary | |
CopyOfReadWriteLock()
Creates a new instance of ReadWriteLock |
|
| Method Summary | |
void |
afterRead()
Call after every read operation |
void |
afterWrite()
Call after every write operation |
protected boolean |
allowReader()
Multiple reads are allowed at the same time and reads are prioritised over writes. |
protected boolean |
allowWriter()
A write can only take place when no other reads or writes are taking place |
void |
beforeRead()
Call before every read operation |
void |
beforeWrite()
Call before every write operation |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CopyOfReadWriteLock()
| Method Detail |
public void afterRead()
public void afterWrite()
protected boolean allowReader()
protected boolean allowWriter()
public void beforeRead()
public void beforeWrite()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||