|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface LockManager
An interface to deal with all aspects of acquiring and releasing locks for cache entries.
| Method Summary | |
|---|---|
boolean |
acquireLock(InvocationContext ctx,
Object key)
Attempts to lock an entry if the lock isn't already held in the current scope, and records the lock in the context. |
boolean |
acquireLock(InvocationContext ctx,
Object key,
long timeoutMillis)
|
boolean |
acquireLockNoCheck(InvocationContext ctx,
Object key)
Same as acquireLock(org.infinispan.context.InvocationContext, Object), but doesn't check whether the
lock is already acquired by the caller. |
int |
getLockId(Object key)
Returns the 'id' of the lock that will be used to guard access to a given key in the cache. |
int |
getNumberOfLocksHeld()
Retrieves the number of locks currently held. |
Object |
getOwner(Object key)
Retrieves the write lock owner, if any, for the specified cache entry. |
boolean |
isLocked(Object key)
Returns true if the cache entry is locked (either for reading or writing) by anyone, and false otherwise. |
boolean |
lockAndRecord(Object key,
InvocationContext ctx,
long timeoutMillis)
Acquires a lock of type lockType, on a specific entry in the cache. |
boolean |
ownsLock(Object key,
Object owner)
Tests whether a given owner owns a lock of lockType on a particular cache entry. |
boolean |
possiblyLocked(CacheEntry entry)
Inspects the entry for signs that it is possibly locked, and hence would need to be unlocked. |
String |
printLockInfo()
Prints lock information for all locks. |
void |
unlock(Collection<Object> lockedKeys,
Object lockOwner)
Releases the lock passed in. |
void |
unlockAll(InvocationContext ctx)
Releases locks present in an invocation context and transaction entry, if one is available. |
| Method Detail |
|---|
boolean lockAndRecord(Object key,
InvocationContext ctx,
long timeoutMillis)
throws InterruptedException
Configuration.getLockAcquisitionTimeout().
key - key to lockctx - invocation context associated with this invocation
InterruptedException - if interrupted
void unlock(Collection<Object> lockedKeys,
Object lockOwner)
void unlockAll(InvocationContext ctx)
ctx - invocation context to inspect
boolean ownsLock(Object key,
Object owner)
owner - owner
boolean isLocked(Object key)
Object getOwner(Object key)
String printLockInfo()
boolean possiblyLocked(CacheEntry entry)
entry - entry to inspect
int getNumberOfLocksHeld()
int getLockId(Object key)
key - key to test for
boolean acquireLock(InvocationContext ctx,
Object key)
throws InterruptedException,
TimeoutException
ctx - contextkey - Key to lock
InterruptedException - if interrupted
TimeoutException - if we are unable to acquire the lock after a specified timeout.
boolean acquireLock(InvocationContext ctx,
Object key,
long timeoutMillis)
throws InterruptedException,
TimeoutException
InterruptedException
TimeoutException
boolean acquireLockNoCheck(InvocationContext ctx,
Object key)
throws InterruptedException,
TimeoutException
acquireLock(org.infinispan.context.InvocationContext, Object), but doesn't check whether the
lock is already acquired by the caller. Useful in the case of transactions that use OwnableReentrantLocks
,as these locks already perform this check internally.
InterruptedException
TimeoutException
|
--> | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||