|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectorg.exist.storage.lock.ReentrantReadWriteLock
public class ReentrantReadWriteLock
A lock with the same semantics as builtin Java synchronized locks: Once a thread has a lock, it can re-obtain it any number of times without blocking. The lock is made available to other threads when as many releases as acquires have occurred. The lock has a timeout: a read lock will be released if the timeout is reached.
| Field Summary | |
|---|---|
int |
mode_
|
| Fields inherited from interface org.exist.storage.lock.Lock |
|---|
NO_LOCK, READ_LOCK, WRITE_LOCK |
| Constructor Summary | |
|---|---|
ReentrantReadWriteLock(String id)
|
|
| 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()
|
long |
holds()
Return the number of unreleased acquires performed by the current thread. |
boolean |
isLockedForWrite()
Returns true if there are active or pending write locks. |
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 |
| Field Detail |
|---|
public int mode_
| Constructor Detail |
|---|
public ReentrantReadWriteLock(String id)
| 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 boolean isLockedForWrite()
Lock
isLockedForWrite in interface Lockpublic boolean hasLock()
hasLock in interface Lockpublic void release(int mode)
Lock
release in interface Lockpublic long holds()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||