private static class CycleDetectingLockFactory.LockGraphNode
extends java.lang.Object
LockGraphNode
associated with each lock instance keeps track of the directed edges in
the lock acquisition graph.Modifier and Type | Field and Description |
---|---|
(package private) java.util.Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.ExampleStackTrace> |
allowedPriorLocks
The map tracking the locks that are known to be acquired before this lock, each associated
with an example stack trace.
|
(package private) java.util.Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.PotentialDeadlockException> |
disallowedPriorLocks
The map tracking lock nodes that can cause a lock acquisition cycle if acquired before this
node.
|
(package private) java.lang.String |
lockName |
Constructor and Description |
---|
LockGraphNode(java.lang.String lockName) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
checkAcquiredLock(CycleDetectingLockFactory.Policy policy,
CycleDetectingLockFactory.LockGraphNode acquiredLock)
Checks the acquisition-ordering between
this , which is about to be acquired, and the
specified acquiredLock . |
(package private) void |
checkAcquiredLocks(CycleDetectingLockFactory.Policy policy,
java.util.List<CycleDetectingLockFactory.LockGraphNode> acquiredLocks) |
private CycleDetectingLockFactory.ExampleStackTrace |
findPathTo(CycleDetectingLockFactory.LockGraphNode node,
java.util.Set<CycleDetectingLockFactory.LockGraphNode> seen)
Performs a depth-first traversal of the graph edges defined by each node's
allowedPriorLocks to find a path between this and the specified lock . |
(package private) java.lang.String |
getLockName() |
final java.util.Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.ExampleStackTrace> allowedPriorLocks
final java.util.Map<CycleDetectingLockFactory.LockGraphNode,CycleDetectingLockFactory.PotentialDeadlockException> disallowedPriorLocks
final java.lang.String lockName
java.lang.String getLockName()
void checkAcquiredLocks(CycleDetectingLockFactory.Policy policy, java.util.List<CycleDetectingLockFactory.LockGraphNode> acquiredLocks)
void checkAcquiredLock(CycleDetectingLockFactory.Policy policy, CycleDetectingLockFactory.LockGraphNode acquiredLock)
this
, which is about to be acquired, and the
specified acquiredLock
.
When this method returns, the acquiredLock
should be in either the
preAcquireLocks
map, for the case in which it is safe to acquire this
after
the acquiredLock
, or in the disallowedPriorLocks
map, in which case it is not
safe.
@Nullable private CycleDetectingLockFactory.ExampleStackTrace findPathTo(CycleDetectingLockFactory.LockGraphNode node, java.util.Set<CycleDetectingLockFactory.LockGraphNode> seen)
allowedPriorLocks
to find a path between this
and the specified lock
.CycleDetectingLockFactory.ExampleStackTrace
illustrating the path to the
lock
, or null
if no path was found.