Package com.dehnes.kotlinredis.lock
Object DeadlockDetection
-
- All Implemented Interfaces:
public class DeadlockDetection
-
-
Field Summary
Fields Modifier and Type Field Description public final static DeadlockDetectionINSTANCE
-
Method Summary
Modifier and Type Method Description final UnitdetectDeadlock(ThreadId detectFor, Map<ThreadId, ThreadWaitingInfo> allWaitingAcrossAllJvms, Boolean allThreadsBailOut)Looks for a cycle of waiting threads, across all JVMs, that leads back to detectFor. -
-
Method Detail
-
detectDeadlock
final Unit detectDeadlock(ThreadId detectFor, Map<ThreadId, ThreadWaitingInfo> allWaitingAcrossAllJvms, Boolean allThreadsBailOut)
Looks for a cycle of waiting threads, across all JVMs, that leads back to detectFor.
A thread waits for the owners of the locks it needs. Because writers are preferred, a thread waiting for a read lock also waits for the threads waiting for the write lock of the same name.
Every thread in a cycle detects it, so only one of them - the one with the greatest ThreadId.redisKey - gives up, and the others keep waiting for its locks. If allThreadsBailOut is set, every thread in the cycle gives up.
-
-
-
-