LockType
- type of lockpublic class LockGrant<LockType> extends Object
A lock grant represents the successful acquisition of a lock. Lock grants can be either valid or invalid. They are created valid but, once the lock is released, they become invalid (meaning the lock granted has been revoked).
Lock grants are organized in chains: the previous lock in a chain is called the predecessor lock and the next lock in the chain is called the successor lock. The first lock in the chain has no predecessor and the last has no successor. Chains are built from the target hierarchy: beginning of the chain is the top element in the target hierarchy and the last element in the lock chain is placed in the bottom element locked in target hierarchy.
When being acquired, predecessor locks must be acquired before and released after. This is handled transparently by locklib.
Lock grants are acquired through LockGrantFuture
.
Synchronization locks on LockGrant
should never be made
outside locklib
Modifier and Type | Method and Description |
---|---|
void |
release()
Releases the grant.
|
LockRequest<LockType> |
request()
Obtains the lock request that generated this grant.
|
Target<LockType> |
target()
Obtains the locked target.
|
String |
toString() |
boolean |
valid()
Checks whether this grant is still valid or not.
|
public boolean valid()
public LockRequest<LockType> request()
public void release()
Target.unlock(LockGrant)
method of this grant's target.Copyright © 2015. All rights reserved.