public final class DatabaseLock
extends java.lang.Object
implements java.util.concurrent.locks.ReadWriteLock
Constructor and Description |
---|
DatabaseLock(java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
void |
lockRead(long timeout)
Tries to get a read lock.
|
void |
lockWrite(long timeout)
Attempts to get an exclusive write lock.
|
java.util.concurrent.locks.Lock |
readLock() |
java.lang.String |
toString() |
void |
unlockRead() |
void |
unlockWrite()
Unlocks the write
|
java.util.concurrent.locks.Lock |
writeLock() |
public java.util.concurrent.locks.Lock readLock()
readLock
in interface java.util.concurrent.locks.ReadWriteLock
public java.util.concurrent.locks.Lock writeLock()
writeLock
in interface java.util.concurrent.locks.ReadWriteLock
public void lockRead(long timeout) throws LockTimeoutException
timeout
- how long to wait for a timeoutLockTimeoutException
public void lockWrite(long timeout)
public void unlockRead()
public void unlockWrite()
public java.lang.String toString()
toString
in class java.lang.Object