|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.terracotta.locking.TerracottaLock
public class TerracottaLock
| Constructor Summary | |
|---|---|
TerracottaLock(Object monitor,
LockType type)
Constructs a lock instance around the given clustered object. |
|
| Method Summary | |
|---|---|
int |
compareTo(Object o)
|
int |
compareTo(TerracottaLock o)
|
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()
|
void |
lock(LockType lockType)
Acquires this lock using a specific lock type. |
void |
lockInterruptibly()
|
void |
lockInterruptibly(LockType lockType)
Acquires this lock using a specific lock type unless the current thread is interrupted. |
Condition |
newCondition()
Condition objects are not supported by this implementation. |
boolean |
tryLock()
|
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. |
boolean |
tryLock(long timeout,
TimeUnit unit)
|
void |
unlock()
|
void |
unlock(LockType lockType)
Releases a lock hold of the specified type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TerracottaLock(Object monitor,
LockType type)
This implementation fully supports the interrupting of lock acquisition.
monitor - clustered object on which locks will be takentype - default lock hold type for this lock
NullPointerException - if the supplied object is null
IllegalArgumentException - if the supplied object is not clustered| Method Detail |
|---|
public void lock()
lock in interface Lockpublic boolean tryLock()
tryLock in interface Lock
public boolean tryLock(long timeout,
TimeUnit unit)
throws InterruptedException
tryLock in interface LockInterruptedExceptionpublic void unlock()
unlock in interface Lockunlock in interface ClusteredLockpublic boolean isHeldByCurrentThread()
ClusteredLock
isHeldByCurrentThread in interface ClusteredLocktrue if the current thread is holding this lock; or false otherwisepublic void lock(LockType lockType)
ClusteredLock
lock in interface ClusteredLocklockType - the type of lock hold that will be acquiredLock.lock()public boolean tryLock(LockType lockType)
ClusteredLock
tryLock in interface ClusteredLocklockType - the type of lock hold that may be acquired
true if the lock was successfully acquired; or false otherwiseLock.tryLock()
public boolean tryLock(LockType lockType,
long timeout,
TimeUnit unit)
throws InterruptedException
ClusteredLock
tryLock in interface ClusteredLocklockType - 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)public void unlock(LockType lockType)
ClusteredLock
unlock in interface ClusteredLocklockType - the type of lock hold that will be releasedClusteredLock.unlock()public boolean isHeldByCurrentThread(LockType lockType)
ClusteredLock
isHeldByCurrentThread in interface ClusteredLocklockType - the type of lock hold to be queried
true if the current thread is holding this lock; or false otherwisepublic int compareTo(TerracottaLock o)
public void lockInterruptibly()
throws InterruptedException
lockInterruptibly in interface LockInterruptedException
public void lockInterruptibly(LockType lockType)
throws InterruptedException
ClusteredLock
lockInterruptibly in interface ClusteredLocklockType - the type of lock that will be acquired
InterruptedException - if the current thread is interrupted while acquiring the lockLock.lockInterruptibly()
public Condition newCondition()
throws UnsupportedOperationException
newCondition in interface LockUnsupportedOperationException - alwayspublic int compareTo(Object o)
compareTo in interface Comparable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||