LinkedTx read;
// Is the blocked transaction blocked by the transaction locking
// this object? This is a deadlock.
if ( waitOn._writeLock == waitingTx ) {
throw new LockNotGrantedException( "persist.deadlock" );
}
read = waitOn._readLock;
while ( read != null ) {
if ( read.tx == waitingTx )
throw new LockNotGrantedException( "persist.deadlock" );
read = read.next;
}
waitOn.detectDeadlock( waitingTx, numOfRec - 1 );
}
} else {
LinkedTx lock;
lock = _readLock;
while ( lock != null ) {
// T1 trying to acquire lock on O1, which is locked by T2
// T2 trying to acauire lock on O1, T1 is waiting on O1
// lock is the blocking transaction. We are only interested in
// a blocked transacrtion.
waitOn = lock.tx.getWaitOnLock();
if ( waitOn != null && lock.tx != waitingTx ) {
LinkedTx read;
if ( waitOn._writeLock == waitingTx ) {
throw new LockNotGrantedException( "persist.deadlock" );
}
read = waitOn._readLock;
while ( read != null ) {
if ( read.tx == waitingTx )
throw new LockNotGrantedException( "persist.deadlock" );
read = read.next;
}
waitOn.detectDeadlock( waitingTx, numOfRec - 1 );
}
lock = lock.next;