public class ConcurrencyUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
ensureLockOrder(java.util.List<java.lang.Object> lockOrder,
java.lang.Object lockBeingTaken)
A helper for determining if we can take the given lock according to the lock order.
|
static boolean |
ensureLocksHeld(java.util.Collection<java.lang.Object> lockOrder)
Ensure that all of the given locks are being held by the current thread.
|
static boolean |
ensureNoLocksHeld()
Ensure that the current thread does not hold any synchronized block locks.
|
static boolean |
ensureNoLocksHeld(java.util.Collection<java.lang.Object> lockOrder)
Ensure that none of the given locks are being held by the current thread.
|
public static boolean ensureLockOrder(java.util.List<java.lang.Object> lockOrder,
java.lang.Object lockBeingTaken)
lockOrder - The lock order we are checking against.lockBeingTaken - The lock we are trying to take. This can either be a ReentrantLock or
an object we're synchronizing on.public static boolean ensureNoLocksHeld(java.util.Collection<java.lang.Object> lockOrder)
lockOrder - The lock order. The order here doesn't matter, but is meant to
mirror ensureLockOrder(List, Object).public static boolean ensureNoLocksHeld()
public static boolean ensureLocksHeld(java.util.Collection<java.lang.Object> lockOrder)
lockOrder - The lock order. The order here doesn't matter, but is meant to
mirror ensureLockOrder(List, Object).