Package org.jgroups.protocols
Class Locking.ClientLock
java.lang.Object
org.jgroups.protocols.Locking.ClientLock
- All Implemented Interfaces:
Comparable<Locking.ClientLock>,Lock
- Enclosing class:
Locking
Implementation of
Lock. This is a client stub communicates with a server equivalent. The semantics are
more or less those of Lock, but may differ slightly.
For details see LockService.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_unlock(boolean force) protected voidprotected voidacquire(boolean throwInterrupt) protected booleanacquireTryLock(long timeout, boolean use_timeout) intbooleanprotected voidhandleLockGrantedResponse(int lock_id) protected voidhandleLockReleasedResponse(int lock_id) booleanisHeld()voidlock()protected voidlockDenied(int lock_id) protected voidlockGranted(int lock_id) voidtoString()booleantryLock()booleanvoidunlock()
-
Field Details
-
name
-
owner
-
acquired
protected volatile boolean acquired -
denied
protected volatile boolean denied -
is_trylock
protected volatile boolean is_trylock -
timeout
protected long timeout -
condition
-
lock_id
protected final int lock_id
-
-
Constructor Details
-
ClientLock
-
ClientLock
-
-
Method Details
-
isHeld
public boolean isHeld() -
lock
public void lock() -
lockInterruptibly
- Specified by:
lockInterruptiblyin interfaceLock- Throws:
InterruptedException
-
tryLock
public boolean tryLock() -
tryLock
- Specified by:
tryLockin interfaceLock- Throws:
InterruptedException
-
unlock
public void unlock() -
newCondition
- Specified by:
newConditionin interfaceLock
-
toString
-
lockGranted
protected void lockGranted(int lock_id) -
lockDenied
protected void lockDenied(int lock_id) -
handleLockGrantedResponse
protected void handleLockGrantedResponse(int lock_id) -
handleLockReleasedResponse
protected void handleLockReleasedResponse(int lock_id) -
acquire
- Throws:
InterruptedException
-
_unlock
protected void _unlock(boolean force) -
_unlockOK
protected void _unlockOK() -
acquireTryLock
- Throws:
InterruptedException
-
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<Locking.ClientLock>
-