Source Code Cross Referenced for ServerTransactionImpl.java in  » Net » Terracotta » com » tc » objectserver » tx » 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 » Net » Terracotta » com.tc.objectserver.tx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
003:         * notice. All rights reserved.
004:         */
005:        package com.tc.objectserver.tx;
006:
007:        import com.tc.net.groups.NodeID;
008:        import com.tc.object.dmi.DmiDescriptor;
009:        import com.tc.object.dna.api.DNA;
010:        import com.tc.object.dna.impl.ObjectStringSerializer;
011:        import com.tc.object.gtx.GlobalTransactionID;
012:        import com.tc.object.gtx.GlobalTransactionIDGenerator;
013:        import com.tc.object.lockmanager.api.LockID;
014:        import com.tc.object.tx.ServerTransactionID;
015:        import com.tc.object.tx.TransactionID;
016:        import com.tc.object.tx.TxnBatchID;
017:        import com.tc.object.tx.TxnType;
018:        import com.tc.util.Assert;
019:        import com.tc.util.SequenceID;
020:
021:        import java.util.Collection;
022:        import java.util.HashSet;
023:        import java.util.Iterator;
024:        import java.util.List;
025:        import java.util.Map;
026:        import java.util.Set;
027:
028:        /**
029:         * Represents an atomic change to the states of objects on the server
030:         * 
031:         * @author steve
032:         */
033:        public class ServerTransactionImpl implements  ServerTransaction {
034:            private final ServerTransactionID serverTxID;
035:            private final SequenceID seqID;
036:            private final List changes;
037:            private final LockID[] lockIDs;
038:            private final TransactionID txID;
039:            private final Map newRoots;
040:            private final NodeID sourceID;
041:            private final TxnType transactionType;
042:            private final ObjectStringSerializer serializer;
043:            private final Collection notifies;
044:            private final DmiDescriptor[] dmis;
045:            private final Set objectIDs;
046:            private final Set newObjectIDs;
047:            private final TxnBatchID batchID;
048:            private final GlobalTransactionID globalTxnID;
049:
050:            public ServerTransactionImpl(GlobalTransactionIDGenerator gtxm,
051:                    TxnBatchID batchID, TransactionID txID,
052:                    SequenceID sequenceID, LockID[] lockIDs, NodeID source,
053:                    List dnas, ObjectStringSerializer serializer, Map newRoots,
054:                    TxnType transactionType, Collection notifies,
055:                    DmiDescriptor[] dmis) {
056:                this .batchID = batchID;
057:                this .txID = txID;
058:                this .seqID = sequenceID;
059:                this .lockIDs = lockIDs;
060:                this .newRoots = newRoots;
061:                this .sourceID = source;
062:                this .serverTxID = new ServerTransactionID(source, txID);
063:                // NOTE::XXX:: GlobalTransactionID is assigned in the process transaction stage. The transaction could be
064:                // re-ordered before apply. This is not a problem because for an transaction to be re-ordered, it should not
065:                // have any common objects between them. hence if g1 is the first txn and g2 is the second txn, g2 can be applied
066:                // before g1 only when g2 has no common objects(or locks) with g1. If this is not true then we cant assign gid here.
067:                this .globalTxnID = gtxm
068:                        .getOrCreateGlobalTransactionID(serverTxID);
069:                this .transactionType = transactionType;
070:                this .notifies = notifies;
071:                this .dmis = dmis;
072:                this .changes = dnas;
073:                this .serializer = serializer;
074:                Set ids = new HashSet(changes.size());
075:                HashSet newIDs = new HashSet(changes.size());
076:                boolean added = true;
077:                for (Iterator i = changes.iterator(); i.hasNext();) {
078:                    DNA dna = (DNA) i.next();
079:                    added &= ids.add(dna.getObjectID());
080:                    if (!dna.isDelta()) {
081:                        newIDs.add(dna.getObjectID());
082:                    }
083:                }
084:                Assert.assertTrue(added);
085:                this .objectIDs = ids;
086:                this .newObjectIDs = newIDs;
087:            }
088:
089:            public ObjectStringSerializer getSerializer() {
090:                return serializer;
091:            }
092:
093:            public LockID[] getLockIDs() {
094:                return lockIDs;
095:            }
096:
097:            public NodeID getSourceID() {
098:                return sourceID;
099:            }
100:
101:            public TransactionID getTransactionID() {
102:                return txID;
103:            }
104:
105:            public SequenceID getClientSequenceID() {
106:                return seqID;
107:            }
108:
109:            public List getChanges() {
110:                return changes;
111:            }
112:
113:            public Map getNewRoots() {
114:                return newRoots;
115:            }
116:
117:            public TxnType getTransactionType() {
118:                return transactionType;
119:            }
120:
121:            public Set getObjectIDs() {
122:                return this .objectIDs;
123:            }
124:
125:            public Set getNewObjectIDs() {
126:                return this .newObjectIDs;
127:            }
128:
129:            public Collection getNotifies() {
130:                return notifies;
131:            }
132:
133:            public DmiDescriptor[] getDmiDescriptors() {
134:                return dmis;
135:            }
136:
137:            public String toString() {
138:                return "ServerTransaction[" + seqID + " , " + txID + ","
139:                        + sourceID + "," + transactionType + "] = { changes = "
140:                        + changes.size() + ", notifies = " + notifies.size()
141:                        + ", newRoots = " + newRoots.size() + "}";
142:            }
143:
144:            public ServerTransactionID getServerTransactionID() {
145:                return serverTxID;
146:            }
147:
148:            public TxnBatchID getBatchID() {
149:                return batchID;
150:            }
151:
152:            public GlobalTransactionID getGlobalTransactionID() {
153:                return this .globalTxnID;
154:            }
155:
156:            public boolean needsBroadcast() {
157:                return true;
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.