ONE_CENTURY, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, ONE_YEAR
Constructor and Description |
---|
ReadWriteLockSync()
default constructor.
|
ReadWriteLockSync(ReentrantReadWriteLock lock)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
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(ReentrantReadWriteLock lock)
lock
- public void lock(LockType type)
public boolean tryLock(LockType type, long msec) throws InterruptedException
tryLock
in interface Sync
type
- the lock type to acquiremsec
- timeoutInterruptedException
- Should the thread be interruptedpublic void unlock(LockType type)
public ReadWriteLock getReadWriteLock()
ReadWriteLock
backing this sync.ReadWriteLock
public boolean isHeldByCurrentThread(LockType type)
isHeldByCurrentThread
in interface Sync
type
- the lock type to testCopyright © 2003–2016 Terracotta, Inc.. All rights reserved.