public class ExtendedStatisticLockManager extends Object implements LockManager
Constructor and Description |
---|
ExtendedStatisticLockManager(LockManager actual,
CacheStatisticManager cacheStatisticManager,
TimeService timeService) |
Modifier and Type | Method and Description |
---|---|
boolean |
acquireLock(InvocationContext ctx,
Object key,
long timeoutMillis,
boolean skipLocking)
Attempts to lock an entry if the lock isn't already held in the current scope, and records the lock in the
context.
|
boolean |
acquireLockNoCheck(InvocationContext ctx,
Object key,
long timeoutMillis,
boolean skipLocking)
Same as
LockManager.acquireLock(org.infinispan.context.InvocationContext, Object, long, boolean) , but doesn't check whether the
lock is already acquired by the caller. |
LockManager |
getActual() |
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.
|
public ExtendedStatisticLockManager(LockManager actual, CacheStatisticManager cacheStatisticManager, TimeService timeService)
public final LockManager getActual()
public boolean lockAndRecord(Object key, InvocationContext ctx, long timeoutMillis) throws InterruptedException
LockManager
Configuration.getLockAcquisitionTimeout()
.
lockAndRecord
in interface LockManager
key
- key to lockctx
- invocation context associated with this invocationInterruptedException
- if interruptedpublic void unlock(Collection<Object> lockedKeys, Object lockOwner)
LockManager
unlock
in interface LockManager
public void unlockAll(InvocationContext ctx)
LockManager
unlockAll
in interface LockManager
ctx
- invocation context to inspectpublic boolean ownsLock(Object key, Object owner)
LockManager
ownsLock
in interface LockManager
owner
- ownerpublic boolean isLocked(Object key)
LockManager
isLocked
in interface LockManager
public Object getOwner(Object key)
LockManager
getOwner
in interface LockManager
public String printLockInfo()
LockManager
printLockInfo
in interface LockManager
public boolean possiblyLocked(CacheEntry entry)
LockManager
possiblyLocked
in interface LockManager
entry
- entry to inspectpublic int getNumberOfLocksHeld()
LockManager
getNumberOfLocksHeld
in interface LockManager
public int getLockId(Object key)
LockManager
getLockId
in interface LockManager
key
- key to test forpublic boolean acquireLock(InvocationContext ctx, Object key, long timeoutMillis, boolean skipLocking) throws InterruptedException, TimeoutException
LockManager
acquireLock
in interface LockManager
ctx
- contextkey
- Key to lockInterruptedException
- if interruptedTimeoutException
- if we are unable to acquire the lock after a specified timeout.public boolean acquireLockNoCheck(InvocationContext ctx, Object key, long timeoutMillis, boolean skipLocking) throws InterruptedException, TimeoutException
LockManager
LockManager.acquireLock(org.infinispan.context.InvocationContext, Object, long, boolean)
, but doesn't check whether the
lock is already acquired by the caller. Useful in the case of transactions that use OwnableReentrantLock
s
,as these locks already perform this check internally.acquireLockNoCheck
in interface LockManager
InterruptedException
TimeoutException
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.