public class DeadlockDetectingLockManager extends LockManagerImpl
DldGlobalTransaction
.
A thread calling LockManager.lockAndRecord(Object, org.infinispan.context.InvocationContext, long)
would run the deadlock detection algorithm only if all of the following take place:
- the call is made in the scope of a transaction (either locally originated or remotely originated)
- it cannot acquire lock on the given key and the lock owner is another transaction
- when comparing coin toss, this thread would loose against the other one - so it's always the potential loser that runs DLD.
If deadlock is detected then LockManager.lockAndRecord(Object, org.infinispan.context.InvocationContext, long)
would throw an
DeadlockDetectedException
. This is subsequently handled in
in the interceptor chain - locks owned by this tx are released.Modifier and Type | Field and Description |
---|---|
protected boolean |
exposeJmxStats |
protected long |
spinDuration |
configuration, lockContainer, trace
Constructor and Description |
---|
DeadlockDetectingLockManager() |
Modifier and Type | Method and Description |
---|---|
long |
getDetectedLocalDeadlocks() |
long |
getDetectedRemoteDeadlocks() |
static long |
getLocallyInterruptedTransactions()
Deprecated.
|
long |
getOverlapWithNotDeadlockAwareLockOwners() |
long |
getTotalNumberOfDetectedDeadlocks() |
void |
init() |
boolean |
lockAndRecord(Object key,
InvocationContext ctx,
long lockTimeout)
Acquires a lock of type lockType, on a specific entry in the cache.
|
void |
resetStatistics() |
void |
setExposeJmxStats(boolean exposeJmxStats) |
acquireLock, acquireLock, acquireLockNoCheck, getConcurrencyLevel, getLockAcquisitionTimeout, getLockId, getNumberOfLocksAvailable, getNumberOfLocksHeld, getOwner, injectDependencies, isLocked, ownsLock, possiblyLocked, printLockInfo, unlock, unlockAll
protected volatile long spinDuration
protected volatile boolean exposeJmxStats
public void init()
public boolean lockAndRecord(Object key, InvocationContext ctx, long lockTimeout) throws InterruptedException
LockManager
Configuration.getLockAcquisitionTimeout()
.
lockAndRecord
in interface LockManager
lockAndRecord
in class LockManagerImpl
key
- key to lockctx
- invocation context associated with this invocationInterruptedException
- if interruptedpublic void setExposeJmxStats(boolean exposeJmxStats)
public long getTotalNumberOfDetectedDeadlocks()
public void resetStatistics()
public long getDetectedRemoteDeadlocks()
public long getDetectedLocalDeadlocks()
public long getOverlapWithNotDeadlockAwareLockOwners()
@Deprecated public static long getLocallyInterruptedTransactions()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.