org.apache.derby.impl.services.locks
Class Deadlock
java.lang.Object
org.apache.derby.impl.services.locks.Deadlock
class Deadlock
- extends java.lang.Object
Code to support deadlock detection.
Method Summary |
private static void |
addInfo(java.lang.StringBuffer sb,
java.lang.String desc,
java.lang.Object data)
|
(package private) static StandardException |
buildException(AbstractPool factory,
java.lang.Object[] data)
|
private static java.util.Hashtable |
getWaiters(LockTable set)
|
private static java.lang.Object[] |
handle(AbstractPool factory,
java.util.Stack chain,
int start,
java.util.Dictionary waiters,
byte deadlockWake)
|
(package private) static java.lang.Object[] |
look(AbstractPool factory,
LockTable set,
LockControl control,
ActiveLock startingLock,
byte deadlockWake)
Look for a deadlock. |
private static void |
rollback(java.util.Stack chain)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Deadlock
private Deadlock()
look
static java.lang.Object[] look(AbstractPool factory,
LockTable set,
LockControl control,
ActiveLock startingLock,
byte deadlockWake)
- Look for a deadlock.
Walk through the graph of all locks and search for cycles among
the waiting lock requests which would indicate a deadlock. A simple
deadlock cycle is where the granted locks of waiting compatibility
space A is blocking compatibility space B and space B holds locks causing
space A to wait.
Would be nice to get a better high level description of deadlock
search.
MT - if the LockTable
is a LockSet
object, the
callers must be synchronized on the LockSet
object in order
to satisfy the syncronization requirements of
LockSet.addWaiters()
. If it is a
ConcurrentLockSet
object, the callers must not hold any of
the ReentrantLock
s guarding the entries in the lock table,
and the callers must make sure that only a single thread calls
look()
at a time.
- Parameters:
factory
- The locking system factoryset
- The complete lock table. A lock table is a hash
table keyed by a Lockable and with a LockControl as
the data element.control
- A LockControl contains a reference to the item being
locked and doubly linked lists for the granted locks
and the waiting locks. The passed in value is the
lock that the caller was waiting on when woken up
to do the deadlock check.startingLock
- represents the specific waiting lock request that
the caller has been waiting on, before just being
woken up to do this search.deadlockWake
- Either Constants.WAITING_LOCK_IN_WAIT, or
Constants.WAITING_LOCK_DEADLOCK.
- Returns:
- The identifier to be used to open the conglomerate later.
- Throws:
StandardException
- Standard exception policy.
rollback
private static void rollback(java.util.Stack chain)
getWaiters
private static java.util.Hashtable getWaiters(LockTable set)
handle
private static java.lang.Object[] handle(AbstractPool factory,
java.util.Stack chain,
int start,
java.util.Dictionary waiters,
byte deadlockWake)
buildException
static StandardException buildException(AbstractPool factory,
java.lang.Object[] data)
addInfo
private static void addInfo(java.lang.StringBuffer sb,
java.lang.String desc,
java.lang.Object data)
Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.