1 21 22 package org.apache.derby.impl.store.access.btree.index; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 26 import org.apache.derby.iapi.error.StandardException; 27 import org.apache.derby.iapi.store.access.conglomerate.Conglomerate; 28 import org.apache.derby.iapi.store.access.conglomerate.TransactionManager; 29 import org.apache.derby.iapi.store.access.ConglomerateController; 30 import org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo; 31 import org.apache.derby.iapi.store.access.GenericScanController; 32 import org.apache.derby.iapi.store.access.Qualifier; 33 import org.apache.derby.iapi.types.RowLocation; 34 import org.apache.derby.iapi.store.access.ScanController; 35 import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo; 36 import org.apache.derby.iapi.store.access.TransactionController; 37 38 import org.apache.derby.iapi.store.raw.LockingPolicy; 39 import org.apache.derby.iapi.store.raw.Transaction; 40 41 import org.apache.derby.iapi.types.DataValueDescriptor; 42 43 import org.apache.derby.iapi.services.io.FormatableBitSet; 44 45 import org.apache.derby.impl.store.access.btree.BTreeController; 46 import org.apache.derby.impl.store.access.btree.BTreeLockingPolicy; 47 import org.apache.derby.impl.store.access.btree.BTreeMaxScan; 48 49 import org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil; 50 51 62 63 public class B2IMaxScan extends BTreeMaxScan 64 { 65 66 69 private ConglomerateController base_cc_for_locking; 70 71 74 75 B2IMaxScan() 76 { 77 super(); 79 } 80 81 85 public void close() 86 throws StandardException 87 { 88 super.close(); 89 90 if (base_cc_for_locking != null) 91 { 92 base_cc_for_locking.close(); 93 base_cc_for_locking = null; 94 } 95 } 96 97 100 public boolean closeForEndTransaction(boolean closeHeldScan) 101 throws StandardException 102 { 103 boolean ret_val = super.closeForEndTransaction(closeHeldScan); 104 105 if (SanityManager.DEBUG) 106 SanityManager.ASSERT( 107 ret_val, "B2IMaxScan never should be held across a commit."); 108 109 if (base_cc_for_locking != null) 110 { 111 base_cc_for_locking.close(); 112 base_cc_for_locking = null; 113 } 114 115 return(ret_val); 116 } 117 118 129 public void init( 130 TransactionManager xact_manager, 131 Transaction rawtran, 132 int open_mode, 133 int lock_level, 134 LockingPolicy locking_policy, 135 int isolation_level, 136 boolean open_for_locking, 137 FormatableBitSet scanColumnList, 138 B2I conglomerate, 139 B2IUndo undo) 140 throws StandardException 141 { 142 144 int base_open_mode = 145 open_mode | TransactionController.OPENMODE_FOR_LOCK_ONLY; 146 147 base_cc_for_locking = 149 xact_manager.openConglomerate( 150 conglomerate.baseConglomerateId, false, 151 base_open_mode, lock_level, 152 isolation_level); 153 154 BTreeLockingPolicy b2i_locking_policy = 155 conglomerate.getBtreeLockingPolicy( 156 rawtran, lock_level, open_mode, isolation_level, 157 base_cc_for_locking, this); 158 159 super.init( 160 xact_manager, 161 rawtran, 162 false, 163 open_mode, 164 lock_level, 165 b2i_locking_policy, 166 scanColumnList, 167 (DataValueDescriptor[]) null, ScanController.NA, (Qualifier[][]) null, (DataValueDescriptor[]) null, ScanController.NA, conglomerate, 173 undo, 174 (StaticCompiledOpenConglomInfo) null, 175 (DynamicCompiledOpenConglomInfo) null); 176 } 177 } 178 | Popular Tags |