A class that provides a classic reader/writer lock functionality. This implementation is based on the JavaWorld article by Tark Modi titled "Lock on to an alternate synchronized mechanism" with some minor modifications.
This lock provides the following functionality :
- Allows multiple threads read access while only a single thread can have a write access.
- Allows a thread owning a read lock to "upgrade" to a write lock.
- Allows a thread owning a write lock to "downgrade" to a read lock.
- Allows the option to either block or specify a waitTime on certain requests.