static class CycleDetectingLock.CycleDetectingLockFactory.ReentrantCycleDetectingLock<ID> extends java.lang.Object implements CycleDetectingLock<ID>
CycleDetectingLock.CycleDetectingLock.CycleDetectingLockFactory<ID>| Modifier and Type | Field and Description |
|---|---|
private CycleDetectingLock.CycleDetectingLockFactory<ID> |
lockFactory
Factory that was used to create this lock.
|
private java.util.concurrent.locks.Lock |
lockImplementation
Underlying lock used for actual waiting when no potential deadlocks are detected.
|
private java.lang.Long |
lockOwnerThreadId
Thread id for the thread that owned this lock.
|
private int |
lockReentranceCount
Number of times that thread owned this lock.
|
private ID |
userLockId
User id for this lock.
|
| Constructor and Description |
|---|
ReentrantCycleDetectingLock(CycleDetectingLock.CycleDetectingLockFactory<ID> lockFactory,
ID userLockId,
java.util.concurrent.locks.Lock lockImplementation) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
checkState()
Check consistency of an internal state.
|
private com.google.common.collect.ListMultimap<java.lang.Long,ID> |
detectPotentialLocksCycle()
Algorithm to detect a potential lock cycle.
|
private java.util.List<ID> |
getAllLockIdsAfter(long threadId,
CycleDetectingLock.CycleDetectingLockFactory.ReentrantCycleDetectingLock lock)
Return locks owned by a thread after a lock specified, inclusive.
|
com.google.common.collect.ListMultimap<java.lang.Long,ID> |
lockOrDetectPotentialLocksCycle()
Takes a lock in a blocking fashion in case no potential deadlocks are detected.
|
java.lang.String |
toString() |
void |
unlock()
Unlocks previously locked lock.
|
private final java.util.concurrent.locks.Lock lockImplementation
private final ID userLockId
private final CycleDetectingLock.CycleDetectingLockFactory<ID> lockFactory
private java.lang.Long lockOwnerThreadId
CycleDetectingLockFactory.this.private int lockReentranceCount
CycleDetectingLockFactory.this.ReentrantCycleDetectingLock(CycleDetectingLock.CycleDetectingLockFactory<ID> lockFactory, ID userLockId, java.util.concurrent.locks.Lock lockImplementation)
public com.google.common.collect.ListMultimap<java.lang.Long,ID> lockOrDetectPotentialLocksCycle()
CycleDetectingLocklockOrDetectPotentialLocksCycle in interface CycleDetectingLock<ID>public void unlock()
CycleDetectingLockunlock in interface CycleDetectingLock<ID>void checkState()
throws java.lang.IllegalStateException
java.lang.IllegalStateExceptionprivate com.google.common.collect.ListMultimap<java.lang.Long,ID> detectPotentialLocksCycle()
private java.util.List<ID> getAllLockIdsAfter(long threadId, CycleDetectingLock.CycleDetectingLockFactory.ReentrantCycleDetectingLock lock)
public java.lang.String toString()
toString in class java.lang.Object