Source Code Cross Referenced for MCInfo.java in  » J2EE » JOnAS-4.8.6 » org » objectweb » jonas » resource » 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 » J2EE » JOnAS 4.8.6 » org.objectweb.jonas.resource 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JOnAS: Java(TM) Open Application Server
003:         * Copyright (C) 1999 Bull S.A.
004:         * Contact: jonas-team@objectweb.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: MCInfo.java 9649 2006-10-02 08:21:28Z coqp $
023:         * --------------------------------------------------------------------------
024:         */
025:
026:        package org.objectweb.jonas.resource;
027:
028:        import java.util.ArrayList;
029:        import java.util.Iterator;
030:        import java.util.List;
031:        import java.util.Vector;
032:
033:        import javax.resource.ResourceException;
034:        import javax.resource.spi.ManagedConnection;
035:        import javax.transaction.Synchronization;
036:        import javax.transaction.xa.XAResource;
037:
038:        /**
039:         *  A ManagedConnection and its Information
040:         *
041:         * @author     sebastien.chassande@inrialpes.fr
042:         * @author     Eric.Hardesty@bull.com
043:         */
044:        public class MCInfo {
045:            /**
046:             *  The managedConnection
047:             */
048:            public ManagedConnection mc;
049:
050:            /**
051:             *  The list of used Connections
052:             */
053:            public Vector usedCs = null;
054:
055:            /**
056:             *  The event used for the later enlisting into transaction
057:             */
058:            public RMEImpl rme = null;
059:
060:            /**
061:             *  Has the ResourceManagerEvent Listener been called
062:             */
063:            public boolean rmeCalled = false;
064:
065:            /**
066:             *  Is the the managedConnection is inside a local transaction
067:             */
068:            public boolean localTransaction = false;
069:
070:            /**
071:             *  If local transaction is used, then here is the LocalXAWrapper to use
072:             *  instead of an XA object
073:             */
074:            public LocalXAWrapper lw = null;
075:
076:            /**
077:             *  The Context linked to the managedConnection instance
078:             * There are three state possible
079:             * global transaction : ctx= the reference to the transaction instance
080:             * local transaction: ctx=null / localTransaction = true
081:             * other ctx = null;
082:             */
083:            public Object ctx;
084:
085:            /**
086:             * The current Synchronisation object  used for the later enlisting into
087:             * the global transaction
088:             */
089:            public Synchronization synchro = null;
090:
091:            /**
092:             * This vector will hold any necessary preparedStatements for this
093:             * ManagedConnection.
094:             */
095:            public List pStmts = null;
096:
097:            /**
098:             *  Has the ConnectionEventListener been set
099:             */
100:            public boolean connectionEventListener = false;
101:
102:            /**
103:             * Constructor for the MCInfo object
104:             * @param mc ManagedConnection to associate with
105:             */
106:            public MCInfo(ManagedConnection mc) {
107:                this .mc = mc;
108:                localTransaction = false;
109:                usedCs = new Vector();
110:                pStmts = new ArrayList();
111:            }
112:
113:            /**
114:             *  Gets the State attribute of the MCInfo object
115:             *
116:             * @param prefix String to print out
117:             * @return         The State value
118:             */
119:            public String getState(String prefix) {
120:                String res = prefix + "* mc=" + mc + "\n";
121:                res += prefix + "Context=" + ctx + "\n";
122:                res += prefix + "size of usedCs:" + usedCs.size() + "\n";
123:                for (int i = 0; i < usedCs.size(); i++) {
124:                    res += prefix + "\t" + usedCs.elementAt(i).toString()
125:                            + "\n";
126:                }
127:                synchronized (pStmts) {
128:                    res += prefix + "size of pStmts:" + pStmts.size() + "\n";
129:                    for (Iterator it = pStmts.iterator(); it.hasNext();) {
130:                        res += prefix + "\t" + it.next() + "\n";
131:                    }
132:                }
133:                return res;
134:            }
135:
136:            /**
137:             * Gets the State attribute of the MCInfo object
138:             * @return String current state
139:             */
140:            public String getState() {
141:                return getState("");
142:            }
143:
144:            /**
145:             * Determine if there is a pStmt to remove
146:             * The method calling this code should use synchronized block
147:             * @return int offset of the first free entry
148:             */
149:            public int findFreeStmt() {
150:                int offset = -1;
151:                int size = pStmts.size();
152:                PreparedStatementWrapper psw = null;
153:                if (pStmts != null) {
154:                    for (int i = 0; i < size; i++) {
155:                        psw = (PreparedStatementWrapper) pStmts.get(i);
156:                        if (psw.isClosed()) {
157:                            offset = i;
158:                            break;
159:                        }
160:                    }
161:                }
162:                return offset;
163:            }
164:
165:            /**
166:             * Fowards the detroy call on the ManagedConnection
167:             * @throws Exception if an Exception occurs
168:             */
169:            public void destroy() throws Exception {
170:                mc.destroy();
171:            }
172:
173:            /**
174:             * Gets the associated XAResource
175:             * @return XAResource associated with this object
176:             * @throws ResourceException if an Exception occurs
177:             */
178:            public XAResource getXAResource() throws ResourceException {
179:                if (lw != null) {
180:                    return lw;
181:                } else {
182:                    return mc.getXAResource();
183:                }
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.