Source Code Cross Referenced for ReadCommittedLocker.java in  » JMX » je » com » sleepycat » je » txn » 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 » JMX » je » com.sleepycat.je.txn 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*-
002:         * See the file LICENSE for redistribution information.
003:         *
004:         * Copyright (c) 2002,2008 Oracle.  All rights reserved.
005:         *
006:         * $Id: ReadCommittedLocker.java,v 1.6.2.4 2008/01/07 15:14:17 cwl Exp $
007:         */
008:
009:        package com.sleepycat.je.txn;
010:
011:        import com.sleepycat.je.DatabaseException;
012:        import com.sleepycat.je.dbi.CursorImpl;
013:        import com.sleepycat.je.dbi.DatabaseImpl;
014:        import com.sleepycat.je.dbi.EnvironmentImpl;
015:        import com.sleepycat.je.tree.BIN;
016:        import com.sleepycat.je.tree.Key;
017:
018:        /**
019:         * Extends BuddyLocker to acquire write locks using the buddy locker (the
020:         * transaction locker).  This is used for ReadCommitted (Degree 2) isolation.
021:         */
022:        public class ReadCommittedLocker extends BuddyLocker {
023:
024:            /**
025:             * Creates a ReadCommittedLocker.
026:             * @param buddy is a transactional locker that will be used for acquiring
027:             * write locks.
028:             */
029:            public ReadCommittedLocker(EnvironmentImpl env, Locker buddy)
030:                    throws DatabaseException {
031:
032:                /*
033:                 * If the buddy param is a read-committed locker, reach in to get its
034:                 * transactional buddy locker.
035:                 */
036:                super (
037:                        env,
038:                        (buddy instanceof  ReadCommittedLocker) ? ((ReadCommittedLocker) buddy)
039:                                .getBuddy()
040:                                : buddy);
041:
042:                assert getBuddy().isTransactional();
043:            }
044:
045:            /**
046:             * Creates a new instance of this txn for the same environment.  No
047:             * transactional locks are held by this object, so no locks are retained.
048:             * newNonTxnLocker is also called for the BuddyLocker.
049:             */
050:            public Locker newNonTxnLocker() throws DatabaseException {
051:
052:                return new ReadCommittedLocker(envImpl, getBuddy()
053:                        .newNonTxnLocker());
054:            }
055:
056:            /**
057:             * Forwards write locks to the buddy locker (the transaction locker).
058:             *
059:             * @see Locker#lockInternal
060:             * @Override
061:             */
062:            LockResult lockInternal(long nodeId, LockType lockType,
063:                    boolean noWait, DatabaseImpl database)
064:                    throws DatabaseException {
065:
066:                if (lockType.isWriteLock()) {
067:                    return getBuddy().lockInternal(nodeId, lockType, noWait,
068:                            database);
069:                } else {
070:                    return super .lockInternal(nodeId, lockType, noWait,
071:                            database);
072:                }
073:            }
074:
075:            /**
076:             * Releases the lock from this locker, or if not owned by this locker then
077:             * releases it from the buddy locker.
078:             */
079:            public void releaseLock(long nodeId) throws DatabaseException {
080:
081:                if (!lockManager.release(nodeId, this )) {
082:                    lockManager.release(nodeId, getBuddy());
083:                }
084:                removeLock(nodeId);
085:            }
086:
087:            /**
088:             * Forwards this method to the transactional buddy.  Since the buddy
089:             * handles write locks, it knows whether this transaction created the node.
090:             */
091:            public boolean createdNode(long nodeId) throws DatabaseException {
092:
093:                return getBuddy().createdNode(nodeId);
094:            }
095:
096:            /**
097:             * Forwards this method to the transactional buddy.  The buddy handles
098:             * write locks and therefore handles abort information.
099:             */
100:            public long getAbortLsn(long nodeId) throws DatabaseException {
101:
102:                return getBuddy().getAbortLsn(nodeId);
103:            }
104:
105:            /**
106:             * @return the WriteLockInfo for this node.
107:             */
108:            public WriteLockInfo getWriteLockInfo(long nodeId)
109:                    throws DatabaseException {
110:
111:                return getBuddy().getWriteLockInfo(nodeId);
112:            }
113:
114:            /**
115:             * Forwards this method to the transactional buddy.  The buddy handles
116:             * write locks and therefore handles delete information.
117:             */
118:            public void addDeleteInfo(BIN bin, Key deletedKey)
119:                    throws DatabaseException {
120:
121:                getBuddy().addDeleteInfo(bin, deletedKey);
122:            }
123:
124:            /**
125:             * Forwards this method to the transactional buddy.  The buddy Txn tracks
126:             * cursors.
127:             */
128:            public void registerCursor(CursorImpl cursor)
129:                    throws DatabaseException {
130:
131:                getBuddy().registerCursor(cursor);
132:            }
133:
134:            /**
135:             * Forwards this method to the transactional buddy.  The buddy Txn tracks
136:             * cursors.
137:             */
138:            public void unRegisterCursor(CursorImpl cursor)
139:                    throws DatabaseException {
140:
141:                getBuddy().unRegisterCursor(cursor);
142:            }
143:
144:            /**
145:             * Is always transactional because the buddy locker is transactional.
146:             */
147:            public boolean isTransactional() {
148:                return true;
149:            }
150:
151:            /**
152:             * Is always read-committed isolation.
153:             */
154:            public boolean isReadCommittedIsolation() {
155:                return true;
156:            }
157:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.