|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.infinispan.util.concurrent.locks.LockManagerImpl
public class LockManagerImpl
Handles locks for the MVCC based LockingInterceptor
Field Summary | |
---|---|
protected Configuration |
configuration
|
protected LockContainer |
lockContainer
|
protected static boolean |
trace
|
Constructor Summary | |
---|---|
LockManagerImpl()
|
Method Summary | |
---|---|
int |
getConcurrencyLevel()
|
protected long |
getLockAcquisitionTimeout(InvocationContext ctx)
|
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 |
getNumberOfLocksAvailable()
|
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. |
void |
injectDependencies(Configuration configuration,
TransactionManager transactionManager,
InvocationContextContainer invocationContextContainer)
|
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)
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 |
releaseLocks(InvocationContext ctx)
Cleanups the locks within the given context. |
void |
startLockManager()
|
void |
unlock(InvocationContext ctx)
Releases locks present in an invocation context and transaction entry, if one is available. |
void |
unlock(Object key)
Releases the lock passed in, held by the specified owner |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Configuration configuration
protected LockContainer lockContainer
protected static final boolean trace
Constructor Detail |
---|
public LockManagerImpl()
Method Detail |
---|
public void injectDependencies(Configuration configuration, TransactionManager transactionManager, InvocationContextContainer invocationContextContainer)
public void startLockManager()
public boolean lockAndRecord(Object key, InvocationContext ctx) throws InterruptedException
LockManager
Configuration.getLockAcquisitionTimeout()
.
lockAndRecord
in interface LockManager
key
- key to lockctx
- invocation context associated with this invocation
InterruptedException
- if interruptedprotected long getLockAcquisitionTimeout(InvocationContext ctx)
public void unlock(Object key)
LockManager
unlock
in interface LockManager
public void unlock(InvocationContext ctx)
LockManager
unlock
in interface LockManager
ctx
- invocation context to inspectpublic boolean ownsLock(Object key, Object owner)
LockManager
ownsLock
in interface LockManager
owner
- owner
public 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 final boolean possiblyLocked(CacheEntry entry)
LockManager
possiblyLocked
in interface LockManager
entry
- entry to inspect
public void releaseLocks(InvocationContext ctx)
LockManager
releaseLocks
in interface LockManager
public int getConcurrencyLevel()
public int getNumberOfLocksHeld()
LockManager
getNumberOfLocksHeld
in interface LockManager
public int getNumberOfLocksAvailable()
public int getLockId(Object key)
LockManager
getLockId
in interface LockManager
key
- key to test for
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |