1 21 22 package org.apache.derby.impl.store.raw.xact; 23 24 import org.apache.derby.iapi.services.locks.LockFactory; 25 import org.apache.derby.iapi.services.locks.Latch; 26 27 import org.apache.derby.iapi.services.sanity.SanityManager; 28 29 import org.apache.derby.iapi.store.raw.ContainerHandle; 30 import org.apache.derby.iapi.store.raw.ContainerLock; 31 import org.apache.derby.iapi.store.raw.RecordHandle; 32 import org.apache.derby.iapi.store.raw.Transaction; 33 34 import org.apache.derby.iapi.error.StandardException; 35 36 37 42 public class RowLocking3Escalate extends ContainerLocking3 43 { 44 protected RowLocking3Escalate(LockFactory lf) 45 { 46 super(lf); 47 } 48 49 73 public boolean lockContainer( 74 Transaction t, 75 ContainerHandle container, 76 boolean waitForLock, 77 boolean forUpdate) 78 throws StandardException 79 { 80 forUpdate = false; 81 82 if (lf.isLockHeld( 85 t.getCompatibilitySpace(), t, 86 container.getId(), ContainerLock.CIX)) 87 { 88 forUpdate = true; 89 } 90 91 boolean gotLock = 93 super.lockContainer(t, container, waitForLock, forUpdate); 94 95 if (!gotLock) 96 return false; 97 98 lf.unlockGroup( 102 t.getCompatibilitySpace(), t, 103 new EscalateContainerKey(container.getId())); 104 105 if (SanityManager.DEBUG) 106 { 107 SanityManager.ASSERT( 108 lf.isLockHeld( 109 t.getCompatibilitySpace(), t, 110 container.getId(), 111 (forUpdate ? ContainerLock.CX : ContainerLock.CS)), 112 "Covering table lock (" + 113 (forUpdate ? ContainerLock.CX : ContainerLock.CS) + 114 " is not held after lock escalation."); 115 } 116 117 return true; 118 } 119 } 120 | Popular Tags |