Class CycleDetectingLockFactory.LockGraphNode
java.lang.Object
com.google.common.util.concurrent.CycleDetectingLockFactory.LockGraphNode
- Enclosing class:
- CycleDetectingLockFactory
A
LockGraphNode associated with each lock instance keeps track of the directed edges in
the lock acquisition graph.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.ExampleStackTrace> The map tracking the locks that are known to be acquired before this lock, each associated with an example stack trace.(package private) final Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.PotentialDeadlockException> The map tracking lock nodes that can cause a lock acquisition cycle if acquired before this node.(package private) final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcheckAcquiredLock(CycleDetectingLockFactory.Policy policy, CycleDetectingLockFactory.LockGraphNode acquiredLock) Checks the acquisition-ordering betweenthis, which is about to be acquired, and the specifiedacquiredLock.(package private) voidcheckAcquiredLocks(CycleDetectingLockFactory.Policy policy, List<CycleDetectingLockFactory.LockGraphNode> acquiredLocks) findPathTo(CycleDetectingLockFactory.LockGraphNode node, Set<CycleDetectingLockFactory.LockGraphNode> seen) Performs a depth-first traversal of the graph edges defined by each node'sallowedPriorLocksto find a path betweenthisand the specifiedlock.(package private) String
-
Field Details
-
allowedPriorLocks
final Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.ExampleStackTrace> allowedPriorLocksThe map tracking the locks that are known to be acquired before this lock, each associated with an example stack trace. Locks are weakly keyed to allow proper garbage collection when they are no longer referenced. -
disallowedPriorLocks
final Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.PotentialDeadlockException> disallowedPriorLocksThe map tracking lock nodes that can cause a lock acquisition cycle if acquired before this node. -
lockName
-
-
Constructor Details
-
LockGraphNode
LockGraphNode(String lockName)
-
-
Method Details
-
getLockName
String getLockName() -
checkAcquiredLocks
void checkAcquiredLocks(CycleDetectingLockFactory.Policy policy, List<CycleDetectingLockFactory.LockGraphNode> acquiredLocks) -
checkAcquiredLock
void checkAcquiredLock(CycleDetectingLockFactory.Policy policy, CycleDetectingLockFactory.LockGraphNode acquiredLock) Checks the acquisition-ordering betweenthis, which is about to be acquired, and the specifiedacquiredLock.When this method returns, the
acquiredLockshould be in either thepreAcquireLocksmap, for the case in which it is safe to acquirethisafter theacquiredLock, or in thedisallowedPriorLocksmap, in which case it is not safe. -
findPathTo
@CheckForNull private CycleDetectingLockFactory.ExampleStackTrace findPathTo(CycleDetectingLockFactory.LockGraphNode node, Set<CycleDetectingLockFactory.LockGraphNode> seen) Performs a depth-first traversal of the graph edges defined by each node'sallowedPriorLocksto find a path betweenthisand the specifiedlock.- Returns:
- If a path was found, a chained
CycleDetectingLockFactory.ExampleStackTraceillustrating the path to thelock, ornullif no path was found.
-