|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.storage.lock.MultiReadReentrantLock
public class MultiReadReentrantLock
A reentrant read/write lock, which allows multiple readers to acquire a lock. Waiting writers are preferred. This is an adapted and bug-fixed version of code taken from Apache's Turbine JCS.
| Field Summary |
|---|
| Fields inherited from interface org.exist.storage.lock.Lock |
|---|
NO_LOCK, READ_LOCK, WRITE_LOCK |
| Constructor Summary | |
|---|---|
MultiReadReentrantLock()
Default constructor. |
|
| Method Summary | |
|---|---|
boolean |
acquire()
Acquire a lock for read. |
boolean |
acquire(int mode)
Acquire a lock for read or write. |
boolean |
attempt(int mode)
Attempt to acquire a lock for read or write. |
boolean |
hasLock()
|
boolean |
isLockedForWrite()
Returns true if there are active or pending write locks. |
void |
release()
|
void |
release(int mode)
Release a lock of the specified type. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiReadReentrantLock()
| Method Detail |
|---|
public boolean acquire()
throws LockException
Lock
acquire in interface LockLockException
public boolean acquire(int mode)
throws LockException
LockLock.READ_LOCK or
Lock.WRITE_LOCK.
acquire in interface LockLockExceptionpublic boolean attempt(int mode)
Lock
attempt in interface Lockpublic void release()
public void release(int mode)
Lock
release in interface Lockpublic boolean isLockedForWrite()
Lock
isLockedForWrite in interface Lockpublic boolean hasLock()
hasLock in interface Lock
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||