Source Code Cross Referenced for B2IRowLocking1.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » access » btree » index » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.access.btree.index 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.store.access.btree.index.B2IRowLocking1
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.store.access.btree.index;
023:
024:        import org.apache.derby.iapi.services.sanity.SanityManager;
025:
026:        import org.apache.derby.iapi.error.StandardException;
027:
028:        import org.apache.derby.iapi.store.access.conglomerate.TransactionManager;
029:
030:        import org.apache.derby.iapi.store.access.ConglomerateController;
031:        import org.apache.derby.iapi.types.RowLocation;
032:        import org.apache.derby.iapi.store.access.TransactionController;
033:
034:        import org.apache.derby.iapi.store.raw.FetchDescriptor;
035:        import org.apache.derby.iapi.store.raw.LockingPolicy;
036:        import org.apache.derby.iapi.store.raw.Page;
037:        import org.apache.derby.iapi.store.raw.RecordHandle;
038:        import org.apache.derby.iapi.store.raw.Transaction;
039:
040:        import org.apache.derby.iapi.types.DataValueDescriptor;
041:
042:        import org.apache.derby.impl.store.access.btree.BTree;
043:        import org.apache.derby.impl.store.access.btree.BTreeLockingPolicy;
044:        import org.apache.derby.impl.store.access.btree.BTreeRowPosition;
045:        import org.apache.derby.impl.store.access.btree.ControlRow;
046:        import org.apache.derby.impl.store.access.btree.LeafControlRow;
047:        import org.apache.derby.impl.store.access.btree.OpenBTree;
048:        import org.apache.derby.impl.store.access.btree.WaitError;
049:
050:        /**
051:
052:         The btree locking policy which implements read uncommitted isolation level.
053:
054:         It inherits all functionality from B2IRowLocking2 except that it does not
055:         get any read row locks (and thus does not release them).  Note that table
056:         level and table level intent locking remains the same as B2IRowLocking2 as
057:         this is currently the way we prevent concurrent ddl from happening while a
058:         read uncommitted scanner is operating in the btree.
059:
060:         **/
061:
062:        class B2IRowLocking1 extends B2IRowLocking2 implements 
063:                BTreeLockingPolicy {
064:            /**************************************************************************
065:             * Fields of the class
066:             **************************************************************************
067:             */
068:
069:            /**************************************************************************
070:             * Constructors for This class:
071:             **************************************************************************
072:             */
073:            B2IRowLocking1(Transaction rawtran, int lock_level,
074:                    LockingPolicy locking_policy,
075:                    ConglomerateController base_cc, OpenBTree open_btree) {
076:                super (rawtran, lock_level, locking_policy, base_cc, open_btree);
077:            }
078:
079:            /**************************************************************************
080:             * Public Methods of This class:
081:             **************************************************************************
082:             */
083:
084:            /**************************************************************************
085:             * Abstract Protected lockScan*() locking methods of BTree:
086:             *     lockScan                 - lock the scan page
087:             *                                (inherit from B2IRowLocking2, we still
088:             *                                 get page control locks).
089:             *     lockScanForReclaimSpace  - lock page for reclaiming deleted rows.
090:             *                                (inherit from B2IRowLocking2, should never
091:             *                                 be called while in read uncommitted).
092:             *     lockScanRow              - lock row and possibly the scan page, only
093:             *                                if row is forUpdate and not a previous key
094:             *                                lock.
095:             *     unlockScan               - unlock the scan page
096:             *                                (inherit from B2IRowLocking2, should never
097:             *                                 be called while in read uncommitted).
098:             *     unlockScanRecordAfterRead- unlock the scan record if we locked it in
099:             *                                lockScanRow.
100:             *                                 
101:             **************************************************************************
102:             */
103:
104:            /**
105:             * Lock a row as part of doing the scan.
106:             * <p>
107:             * Lock the row at the given slot (or the previous row if slot is 0).
108:             * Get the scan lock on the page if "request_scan_lock" is true.
109:             * <p>
110:             * If this routine returns true all locks were acquired while maintaining
111:             * the latch on leaf.  If this routine returns false, locks may or may
112:             * not have been acquired, and the routine should be called again after
113:             * the client has researched the tree to reget the latch on the 
114:             * appropriate page.
115:             * (p>
116:             * As a side effect stores the value of the record handle of the current
117:             * scan lock.
118:             *
119:             * @return Whether locks were acquired without releasing latch on leaf.
120:             *
121:             * @param open_btree        The open_btree to associate latches with - 
122:             *                          used if routine has to scan backward.
123:             * @param btree             the conglomerate info.
124:             * @param pos               The position of the row to lock.
125:             * @param request_scan_lock Whether to request the page scan lock, should
126:             *                          only be requested once per page in the scan.
127:             * @param lock_template     A scratch area to use to read in rows.
128:             * @param previous_key_lock Is this a previous key lock call?
129:             * @param forUpdate         Is the scan for update or for read only.
130:             *
131:             * @exception  StandardException  Standard exception policy.
132:             **/
133:            public boolean lockScanRow(OpenBTree open_btree, BTree btree,
134:                    BTreeRowPosition pos, boolean request_scan_lock,
135:                    FetchDescriptor lock_fetch_desc,
136:                    DataValueDescriptor[] lock_template,
137:                    RowLocation lock_row_loc, boolean previous_key_lock,
138:                    boolean forUpdate, int lock_operation)
139:                    throws StandardException {
140:                // request the scan lock if necessary.
141:                // only get the row lock if it is not a previous key lock and iff
142:                // it is an update lock.
143:                return (_lockScanRow(open_btree,
144:                        btree,
145:                        pos,
146:                        (forUpdate && !previous_key_lock), // only get update row lock
147:                        request_scan_lock, lock_fetch_desc, lock_template,
148:                        lock_row_loc, previous_key_lock, forUpdate,
149:                        lock_operation));
150:            }
151:
152:            /**
153:             * Release read lock on a row.
154:             *
155:             * Because this is read uncommitted no S row locks will have been requested,
156:             * thus none need be released.  The only locks that need to be released
157:             * are U locks requested if the scan was opened for update.
158:             *
159:             * @param pos               The position of the row to unlock.
160:             * @param forUpdate         Is the scan for update or for read only.
161:             *
162:             **/
163:            public void unlockScanRecordAfterRead(BTreeRowPosition pos,
164:                    boolean forUpdate) throws StandardException {
165:                if (forUpdate) {
166:                    super .unlockScanRecordAfterRead(pos, forUpdate);
167:                }
168:            }
169:
170:            /**************************************************************************
171:             * Abstract Protected lockNonScan*() locking methods of BTree:
172:             *
173:             *     lockNonScanPreviousRow   - lock the row previous to the current
174:             *                                (inherit from B2IRowLocking2, we still 
175:             *                                 get page control locks) - only called
176:             *                                 by insert.
177:             *     lockNonScanRow           - lock the input row
178:             *                                (inherit from B2IRowLocking2, we still
179:             *                                 get page control locks) - only called
180:             *                                 by insert.
181:             **************************************************************************
182:             */
183:
184:        }
w_ww.___j___a_v__a__2_s___._c__o_m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.