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.store.access.ScanController; 34 import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo; 35 import org.apache.derby.iapi.store.access.TransactionController; 36 37 import org.apache.derby.iapi.store.raw.ContainerHandle; 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.types.RowLocation; 44 45 import org.apache.derby.iapi.services.io.FormatableBitSet; 46 47 import org.apache.derby.impl.store.access.btree.BTreeController; 48 import org.apache.derby.impl.store.access.btree.BTreeLockingPolicy; 49 import org.apache.derby.impl.store.access.btree.BTreeForwardScan; 50 51 import org.apache.derby.impl.store.access.conglomerate.ConglomerateUtil; 52 53 71 72 public class B2IForwardScan extends BTreeForwardScan 73 { 74 75 78 private ConglomerateController base_cc_for_locking; 79 private int init_isolation_level; 80 81 84 85 B2IForwardScan() 86 { 87 super(); 89 } 90 91 95 public void close() 96 throws StandardException 97 { 98 super.close(); 99 100 if (base_cc_for_locking != null) 101 { 102 base_cc_for_locking.close(); 103 base_cc_for_locking = null; 104 } 105 } 106 107 108 111 public boolean closeForEndTransaction(boolean closeHeldScan) 112 throws StandardException 113 { 114 boolean ret_val = super.closeForEndTransaction(closeHeldScan); 115 116 if (base_cc_for_locking != null) 117 { 118 base_cc_for_locking.close(); 119 base_cc_for_locking = null; 120 } 121 122 return(ret_val); 123 } 124 125 134 public ContainerHandle reopen() 135 throws StandardException 136 { 137 138 ContainerHandle container = super.reopen(); 139 B2I b2i = (B2I) getConglomerate(); 140 141 143 int base_open_mode = 144 getOpenMode() | TransactionController.OPENMODE_FOR_LOCK_ONLY; 145 146 147 149 150 165 { 166 base_cc_for_locking = 167 getXactMgr().openConglomerate( 168 b2i.baseConglomerateId, 169 false, 170 base_open_mode, init_lock_level, 171 init_isolation_level); 172 173 setLockingPolicy( 174 b2i.getBtreeLockingPolicy( 175 getXactMgr().getRawStoreXact(), 176 getLockLevel(), 177 getOpenMode(), 178 init_isolation_level, 179 base_cc_for_locking, this)); 180 } 181 182 return(container); 183 } 184 185 186 197 public void init( 198 TransactionManager xact_manager, 199 Transaction rawtran, 200 boolean hold, 201 int open_mode, 202 int lock_level, 203 LockingPolicy locking_policy, 204 int isolation_level, 205 boolean open_for_locking, 206 FormatableBitSet scanColumnList, 207 DataValueDescriptor[] startKeyValue, 208 int startSearchOperator, 209 Qualifier qualifier[][], 210 DataValueDescriptor[] stopKeyValue, 211 int stopSearchOperator, 212 B2I conglomerate, 213 B2IUndo undo, 214 B2IStaticCompiledInfo static_info, 215 DynamicCompiledOpenConglomInfo dynamic_info) 216 throws StandardException 217 { 218 220 int base_open_mode = 221 open_mode | TransactionController.OPENMODE_FOR_LOCK_ONLY; 222 223 if (static_info != null) 225 { 226 base_cc_for_locking = 227 xact_manager.openCompiledConglomerate( 228 false, 229 base_open_mode, lock_level, isolation_level, 230 static_info.base_table_static_info, 231 232 ((Conglomerate) static_info.getConglom()). 233 getDynamicCompiledConglomInfo( 234 conglomerate.baseConglomerateId)); 235 } 236 else 237 { 238 base_cc_for_locking = 239 xact_manager.openConglomerate( 240 conglomerate.baseConglomerateId, false, base_open_mode, lock_level, 241 isolation_level); 242 } 243 244 BTreeLockingPolicy b2i_locking_policy = 245 conglomerate.getBtreeLockingPolicy( 246 rawtran, lock_level, open_mode, isolation_level, 247 base_cc_for_locking, this); 248 249 super.init( 250 xact_manager, 251 rawtran, 252 hold, 253 open_mode, 254 lock_level, 255 b2i_locking_policy, 256 scanColumnList, 257 startKeyValue, 258 startSearchOperator, 259 qualifier, 260 stopKeyValue, 261 stopSearchOperator, 262 conglomerate, 263 undo, 264 static_info, 265 dynamic_info); 266 267 268 init_isolation_level = isolation_level; 271 } 272 } 273 | Popular Tags |