--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.store.access.btree.index.B2IRowLocking2\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to you under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.store.access.btree.index;\r
+\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+\r
+import org.apache.derby.iapi.error.StandardException; \r
+\r
+import org.apache.derby.iapi.store.access.ConglomerateController;\r
+\r
+import org.apache.derby.iapi.store.raw.LockingPolicy;\r
+import org.apache.derby.iapi.store.raw.Transaction;\r
+\r
+import org.apache.derby.impl.store.access.btree.BTreeLockingPolicy;\r
+import org.apache.derby.impl.store.access.btree.BTreeRowPosition;\r
+import org.apache.derby.impl.store.access.btree.OpenBTree;\r
+\r
+/**\r
+\r
+The btree locking policy which implements read committed isolation level.\r
+\r
+It inherits all functionality from B2IRowLockingRR (repeatable read) except \r
+that it releases read locks after obtaining them. It provides a single\r
+implementation of unlockScanRecordAfterRead() which releases a read lock\r
+after it has been locked and processed.\r
+\r
+**/\r
+\r
+class B2IRowLocking2 extends B2IRowLockingRR implements BTreeLockingPolicy\r
+{\r
+\r
+ /**************************************************************************\r
+ * Constructors for This class:\r
+ **************************************************************************\r
+ */\r
+ B2IRowLocking2(\r
+ Transaction rawtran,\r
+ int lock_level,\r
+ LockingPolicy locking_policy,\r
+ ConglomerateController base_cc,\r
+ OpenBTree open_btree)\r
+ {\r
+ super(rawtran, lock_level, locking_policy, base_cc, open_btree);\r
+ }\r
+\r
+ /**************************************************************************\r
+ * Public Methods of This class:\r
+ **************************************************************************\r
+ */\r
+\r
+\r
+ /**\r
+ * Release read lock on a row.\r
+ *\r
+ * @param forUpdate Is the scan for update or for read only.\r
+ *\r
+ **/\r
+ public void unlockScanRecordAfterRead(\r
+ BTreeRowPosition pos,\r
+ boolean forUpdate)\r
+ throws StandardException\r
+ {\r
+ if (SanityManager.DEBUG)\r
+ {\r
+ SanityManager.ASSERT(open_btree != null, "open_btree is null");\r
+\r
+ SanityManager.ASSERT(pos.current_leaf != null , "leaf is null");\r
+\r
+ SanityManager.ASSERT(\r
+ pos.current_lock_row_loc != null , \r
+ "pos.current_lock_row_loc is null");\r
+\r
+ SanityManager.ASSERT(\r
+ !pos.current_lock_row_loc.isNull(), \r
+ "pos.current_lock_row_loc isNull()");\r
+ }\r
+\r
+ // always unlock in read committed, so pass false for qualified arg.\r
+ base_cc.unlockRowAfterRead(pos.current_lock_row_loc, forUpdate, false);\r
+ }\r
+}\r