|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
K - supported key typepublic interface LockStrategy<K>
Implementations of LockStrategy can be supplied to implement custom map locking strategies.
Potential implementors are strongly advised to consider subclassing BasicLockStrategy instead of directly
implementing this class.
| Method Summary | |
|---|---|
void |
beginLock(String lockID,
int type)
Called to acquire a lock on the given lockId at the given level. |
void |
commitLock(String lockID,
int type)
Called to release a lock on the given lockId held at the given level. |
String |
generateLockIdForKey(String instanceQualifier,
K key)
Generate the lock identifier to be used when performing operations for the given key. |
void |
pinLock(String lockID)
Called to indicate that the associated lock might be required frequently. |
boolean |
tryBeginLock(String lockID,
int type,
long nanos)
Called to attempt to acquire a lock on the given lockId at the given level. |
void |
unpinLock(String lockID)
Called to indicate that the associated lock is no longer required frequently. |
| Method Detail |
|---|
String generateLockIdForKey(String instanceQualifier,
K key)
To prevent inter-map lock collisions the instanceQualifier provided by the caller should be used to form
the key.
generateLockIdForKey in interface GenericLockStrategy<String,K>instanceQualifier - A unique identifier for the map being operated on.key - key to be locked
void beginLock(String lockID,
int type)
beginLock in interface GenericLockStrategy<String,K>lockID - lock to locktype - hold type to acquirevoid pinLock(String lockID)
This call can be used to help guide resource allocation and collection.
pinLock in interface GenericLockStrategy<String,K>lockId - lock to `pin'void unpinLock(String lockID)
This call can be used to help guide resource allocation and collection.
unpinLock in interface GenericLockStrategy<String,K>lock - lock to `unpin'
void commitLock(String lockID,
int type)
commitLock in interface GenericLockStrategy<String,K>lockID - lock to unlocktype - hold type to release
boolean tryBeginLock(String lockID,
int type,
long nanos)
throws InterruptedException
tryBeginLock in interface GenericLockStrategy<String,K>lockID - lock to locktype - hold type to acquiretime - to wait for lock in nanoseconds
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||