|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ClusteredLock
Provides primitive lock operations for the granularity that was used to create an instance of this lock. At the
creation of a ClusteredLock instance a default lock type is also stored, which is corresponds to the
default lock type of the underlying data structure.
| Method Summary | |
|---|---|
boolean |
isHeldByCurrentThread()
Indicates whether the current thread is holding this lock with the default lock type. |
boolean |
isHeldByCurrentThread(LockType lockType)
Indicates whether the current thread is holding this lock with the specific lock type. |
void |
lock(LockType lockType)
Acquires this lock using a specific lock type. |
void |
lockInterruptibly(LockType lockType)
Acquires this lock using a specific lock type unless the current thread is interrupted. |
boolean |
tryLock(LockType lockType)
Acquires this lock using a specific lock type only if the lock is available at the time of invocation. |
boolean |
tryLock(LockType lockType,
long timeout,
TimeUnit unit)
Acquires this lock using a specific lock type only if it is available within the given time and the current thread has not been interrupted. |
void |
unlock()
|
void |
unlock(LockType lockType)
Releases a lock hold of the specified type. |
| Methods inherited from interface java.util.concurrent.locks.Lock |
|---|
lock, lockInterruptibly, newCondition, tryLock, tryLock |
| Method Detail |
|---|
void lock(LockType lockType)
lockType - the type of lock hold that will be acquiredLock.lock()boolean tryLock(LockType lockType)
lockType - the type of lock hold that may be acquired
true if the lock was successfully acquired; or false otherwiseLock.tryLock()
boolean tryLock(LockType lockType,
long timeout,
TimeUnit unit)
throws InterruptedException
lockType - the type of lock hold that may be acquiredtimeout - the maximum time to waitunit - the time unit of the timeout argument
true if the lock was successfully acquired; or false otherwise
InterruptedException - if the current thread is interrupted during lock acquisitionLock.tryLock(long, TimeUnit)void unlock()
unlock in interface LockIllegalMonitorStateException - on attempting to unlock a lock that is not heldvoid unlock(LockType lockType)
lockType - the type of lock hold that will be releasedunlock()boolean isHeldByCurrentThread()
true if the current thread is holding this lock; or false otherwiseboolean isHeldByCurrentThread(LockType lockType)
lockType - the type of lock hold to be queried
true if the current thread is holding this lock; or false otherwise
void lockInterruptibly(LockType lockType)
throws InterruptedException
lockType - the type of lock that will be acquired
InterruptedException - if the current thread is interrupted while acquiring the lockLock.lockInterruptibly()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||