Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.locks.ReentrantReadWriteLock |
rrwl |
ONE_CENTURY, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR
Constructor and Description |
---|
ReadWriteLockSync()
default constructor.
|
ReadWriteLockSync(java.util.concurrent.locks.ReentrantReadWriteLock lock)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private java.util.concurrent.locks.Lock |
getLock(LockType type) |
java.util.concurrent.locks.ReadWriteLock |
getReadWriteLock()
Gets the
ReadWriteLock backing this sync. |
boolean |
isHeldByCurrentThread(LockType type)
Returns true is this is lock is held at given level by the current thread.
|
void |
lock(LockType type)
Acquire lock of LockType.READ or WRITE
|
boolean |
tryLock(LockType type,
long msec)
Tries to acquire a LockType.READ or WRITE for a certain period
|
void |
unlock(LockType type)
Releases the lock held by the current Thread.
|
public ReadWriteLockSync()
public ReadWriteLockSync(java.util.concurrent.locks.ReentrantReadWriteLock lock)
lock
- public void lock(LockType type)
public boolean tryLock(LockType type, long msec) throws java.lang.InterruptedException
public void unlock(LockType type)
private java.util.concurrent.locks.Lock getLock(LockType type)
public java.util.concurrent.locks.ReadWriteLock getReadWriteLock()
ReadWriteLock
backing this sync.ReadWriteLock
public boolean isHeldByCurrentThread(LockType type)
isHeldByCurrentThread
in interface Sync
type
- the lock type to test