|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.storage.lock.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 |
isLockedForWrite()
Returns true if there are active or pending write locks. |
void |
release()
Release a lock. |
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 Lock
LockException
public boolean acquire(int mode) throws LockException
Lock
Lock.READ_LOCK
or
Lock.WRITE_LOCK
.
acquire
in interface Lock
mode
-
LockException
public boolean attempt(int mode)
Lock
attempt
in interface Lock
mode
- public void release()
Lock
release
in interface Lock
public void release(int mode)
Lock
release
in interface Lock
mode
- public boolean isLockedForWrite()
Lock
isLockedForWrite
in interface Lock
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |