Source Code Cross Referenced for RowLock.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » store » raw » 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.iapi.store.raw 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.iapi.store.raw.RowLock
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.iapi.store.raw;
023:
024:        /**
025:         A RowLock represents a qualifier that is to be used when
026:         locking a Row through a RecordHandle.
027:
028:         <BR>
029:         MT - Immutable
030:
031:         @see RecordHandle
032:         @see LockingPolicy
033:         */
034:
035:        public final class RowLock {
036:
037:            private final int type;
038:
039:            // Names of locks for virtual lock table print out
040:            private static String[] shortnames = { "S", "S", "U", "U", "X",
041:                    "X", "X", "X" };
042:
043:            /* Row Shared lock for repeatable read and below isolation level */
044:            public static final RowLock RS2 = new RowLock(0);
045:            /* Row Shared lock for serialized read isolation level */
046:            public static final RowLock RS3 = new RowLock(1);
047:            /* Row Update lock for reapeatable read and below isolation level*/
048:            public static final RowLock RU2 = new RowLock(2);
049:            /* Row Update lock for serializable isolation level*/
050:            public static final RowLock RU3 = new RowLock(3);
051:            /* Row Insert previous key lock */
052:            public static final RowLock RIP = new RowLock(4);
053:            /* Row Insert lock */
054:            public static final RowLock RI = new RowLock(5);
055:            /* Row exclusive write lock for repeatable read and below isolation level */
056:            public static final RowLock RX2 = new RowLock(6);
057:            /* Row exclusive write lock for serializable isolation level */
058:            public static final RowLock RX3 = new RowLock(7);
059:
060:            /** Number of row locks */
061:            public static final int R_NUMBER = 8;
062:
063:            /** Row lock compatability table */
064:            public static final boolean[][] R_COMPAT = {
065:                    //          Granted
066:                    // Request   RS2     RS3    RU2    RU3    RIP    RI     RX2    RX3
067:                    //
068:                    /* RS2 */{ true, true, true, true, true, false, false,
069:                            false },
070:                    /* RS3 */{ true, true, true, true, false, false, false,
071:                            false },
072:                    /* RU2 */{ true, true, false, false, true, false, false,
073:                            false },
074:                    /* RU3 */{ true, true, false, false, false, false, false,
075:                            false },
076:                    /* RIP */{ true, false, true, false, true, true, true,
077:                            false },
078:                    /* RI  */{ false, false, false, false, true, false, false,
079:                            false },
080:                    /* RX2 */{ false, false, false, false, true, false, false,
081:                            false },
082:                    /* RX3 */{ false, false, false, false, false, false,
083:                            false, false } };
084:
085:            /* lock debugging stuff */
086:            public static final String DIAG_INDEX = "index";
087:            public static final String DIAG_XACTID = "xactid";
088:            public static final String DIAG_LOCKTYPE = "locktype";
089:            public static final String DIAG_LOCKMODE = "lockmode";
090:            public static final String DIAG_CONGLOMID = "conglomId";
091:            public static final String DIAG_CONTAINERID = "containerId";
092:            public static final String DIAG_SEGMENTID = "segmentId";
093:            public static final String DIAG_PAGENUM = "pageNum";
094:            public static final String DIAG_RECID = "RecId";
095:            public static final String DIAG_COUNT = "count";
096:            public static final String DIAG_GROUP = "group";
097:            public static final String DIAG_STATE = "state";
098:
099:            private RowLock(int type) {
100:                this .type = type;
101:            }
102:
103:            /**
104:            	Get an integer representation of the type of the lock. This method is 
105:                guaranteed to return an integer >= 0 and < R_NUMBER. No correlation 
106:                between the value and one of the static variables (CIS etc.) is 
107:                guaranteed, except that the values returned do not change.
108:             */
109:            public int getType() {
110:                return type;
111:            }
112:
113:            public boolean isCompatible(RowLock granted) {
114:
115:                return isCompatible(granted.getType());
116:            }
117:
118:            public boolean isCompatible(int granted) {
119:
120:                return R_COMPAT[getType()][granted];
121:            }
122:
123:            public String toString() {
124:                return shortnames[getType()];
125:            }
126:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.