Java Doc for StandardXAConnection.java in  » Database-JDBC-Connection-Pool » xapool » org » enhydra » jdbc » standard » 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 JDBC Connection Pool » xapool » org.enhydra.jdbc.standard 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.enhydra.jdbc.standard.StandardPooledConnection
      org.enhydra.jdbc.standard.StandardXAConnection

All known Subclasses:   org.enhydra.jdbc.instantdb.IdbXAConnection,  org.enhydra.jdbc.oracle.OracleXAConnection,  org.enhydra.jdbc.sybase.SybaseXAConnection,  org.enhydra.jdbc.informix.InformixXAConnection,
StandardXAConnection
public class StandardXAConnection extends StandardPooledConnection implements XAConnection,XAResource,Referenceable,Runnable(Code)
Provides a generic wrapper for JDBC 1 drivers. JDBC 1 drivers always associate a single transaction at every point in time with a physical connection. J2EE drivers, on the other hand, allow an XAResource (and therefore an XAConnection with which it has a one to one mapping) to switch between global transactions.

To accomodate this, the StandardXADataSource class maintains a list of Connection objects. When the Transaction Manager associates an XID with a StandardXAConnection, it looks for a physical connection which is associated with that transaction.

The "current" connection (super.con and curCon) is the connection currently being used by the application (i.e. getConnection has been called, but not Connection.close()). The current connection is removed and handed to the data source if it becomes associated with a global transaction.



Field Summary
public  StandardXAConnectionHandleconnectionHandle
    
protected  StandardXAStatefulConnectioncurCon
    
 booleanisClosed
    
public  booleanthisAutoCommit
    
public  ThreadtimerThread
    
public  TransactionManagertransactionManager
    
protected  StandardXADataSourcexaDataSource
    

Constructor Summary
public  StandardXAConnection(StandardXADataSource dataSource, String user, String password)
     Creates the first free connection.

Method Summary
public  StandardXAStatefulConnectioncheckPreparedState(Xid xid)
     Does most of the work of a generic prepare.
public synchronized  voidclose()
     Close this XA connection.
public synchronized  voidcommit(Xid xid, boolean onePhase)
     Performs a commit on this resource manager's branch of the global transaction.
public synchronized  voiddoStart(Xid xid, int flags)
     Does most of the work of the start() call (below).
public synchronized  voidend(Xid xid, int flags)
     Ends a connection's association with a global transaction.

It need not act on the current transaction.

public  voidforget(Xid xid)
     This is called by a TM when the RM has reported a heuristic completion.
public  booleangetCommitOnPrepare()
    
public synchronized  ConnectiongetConnection()
     Creates a new StandardXAConnectionHandle for use by an application. If there is already an StandardXAConnectionHandle in use then it is closed (i.e.
public  ReferencegetReference()
    
public  intgetTransactionTimeout()
    
public  XAResourcegetXAResource()
     We are required to maintain a 1-1 mapping between an XAConnection and its corresponding XAResource.
public  booleanisSameRM(XAResource xares)
    
protected  voidnewConnectionHandle()
    
public  intprepare(Xid xid)
     Prepares to perform a commit.
public  Xid[]recover(int flag)
     Called by the transaction manager during recovery.
public synchronized  voidrollback(Xid xid)
     PERFORMS a rollback on this resource manager's branch of the global transaction.
public  voidrun()
     Periodically checks for timed out connections.
public  voidsetCommitOnPrepare(boolean commitOnPrepare)
    
public  voidsetTransactionManager(TransactionManager tm)
    
public  booleansetTransactionTimeout(int seconds)
     Accessor methods for timeout.
public synchronized  voidstart(Xid xid, int flags)
     Associates this XAConnection with a global transaction.
public  StringtoString()
    

Field Detail
connectionHandle
public StandardXAConnectionHandle connectionHandle(Code)



curCon
protected StandardXAStatefulConnection curCon(Code)



isClosed
boolean isClosed(Code)



thisAutoCommit
public boolean thisAutoCommit(Code)



timerThread
public Thread timerThread(Code)



transactionManager
public TransactionManager transactionManager(Code)



xaDataSource
protected StandardXADataSource xaDataSource(Code)




Constructor Detail
StandardXAConnection
public StandardXAConnection(StandardXADataSource dataSource, String user, String password) throws SQLException(Code)
Creates the first free connection.




Method Detail
checkPreparedState
public StandardXAStatefulConnection checkPreparedState(Xid xid) throws XAException(Code)
Does most of the work of a generic prepare. Kept as a separate method so that sub-classes can call it and get the StandardXAStatefulConnection back.



close
public synchronized void close() throws java.sql.SQLException(Code)
Close this XA connection.



commit
public synchronized void commit(Xid xid, boolean onePhase) throws XAException(Code)
Performs a commit on this resource manager's branch of the global transaction.



doStart
public synchronized void doStart(Xid xid, int flags) throws XAException(Code)
Does most of the work of the start() call (below). Kept as a separate method so that subclasses can call it and retain the curCon property.



end
public synchronized void end(Xid xid, int flags) throws XAException(Code)
Ends a connection's association with a global transaction.

It need not act on the current transaction. There is an interval between being returned to the pool manager and being invoked by the transaction manager during which the current connection can change.

Note that the only effect is to change the connection state.




forget
public void forget(Xid xid) throws XAException(Code)
This is called by a TM when the RM has reported a heuristic completion. It must retain the transaction context until told to forget about it.



getCommitOnPrepare
public boolean getCommitOnPrepare()(Code)



getConnection
public synchronized Connection getConnection() throws SQLException(Code)
Creates a new StandardXAConnectionHandle for use by an application. If there is already an StandardXAConnectionHandle in use then it is closed (i.e. the application has the connection withdrawn).

This method always returns a Connection in the free state (i.e. (not associated with an Xid). This is necessary since, unless Start (Xid, flags) gets called, the Connection must do local transaction processing.




getReference
public Reference getReference() throws NamingException(Code)



getTransactionTimeout
public int getTransactionTimeout()(Code)



getXAResource
public XAResource getXAResource()(Code)
We are required to maintain a 1-1 mapping between an XAConnection and its corresponding XAResource. We achieve this by implementing both interfaces in the same class.



isSameRM
public boolean isSameRM(XAResource xares) throws XAException(Code)



newConnectionHandle
protected void newConnectionHandle()(Code)



prepare
public int prepare(Xid xid) throws XAException(Code)
Prepares to perform a commit. May actually perform a commit in the flag commitOnPrepare is set to true.



recover
public Xid[] recover(int flag) throws XAException(Code)
Called by the transaction manager during recovery. If it was the transaction manager or another compoenent which failed then we can supply our known Xids. However if we failed then this method does nothing - we need to know about database internals to do that.



rollback
public synchronized void rollback(Xid xid) throws XAException(Code)
PERFORMS a rollback on this resource manager's branch of the global transaction.



run
public void run()(Code)
Periodically checks for timed out connections.



setCommitOnPrepare
public void setCommitOnPrepare(boolean commitOnPrepare)(Code)



setTransactionManager
public void setTransactionManager(TransactionManager tm)(Code)



setTransactionTimeout
public boolean setTransactionTimeout(int seconds)(Code)
Accessor methods for timeout.



start
public synchronized void start(Xid xid, int flags) throws XAException(Code)
Associates this XAConnection with a global transaction. This is the only method which can associate the current connection with a global transaction. It acts only on the current connection which must have been previously established using getConnection.



toString
public String toString()(Code)



Fields inherited from org.enhydra.jdbc.standard.StandardPooledConnection
public Connection con(Code)(Java Doc)
public StandardConnectionHandle connectionHandle(Code)(Java Doc)
protected StandardConnectionPoolDataSource dataSource(Code)(Java Doc)
boolean isClosed(Code)(Java Doc)
Vector listeners(Code)(Java Doc)
public Logger log(Code)(Java Doc)

Methods inherited from org.enhydra.jdbc.standard.StandardPooledConnection
public void addConnectionEventListener(ConnectionEventListener listener)(Code)(Java Doc)
public void close() throws java.sql.SQLException(Code)(Java Doc)
void closeEvent()(Code)(Java Doc)
public void connectionErrorOccurred(ConnectionEvent event)(Code)(Java Doc)
public synchronized Connection getConnection() throws java.sql.SQLException(Code)(Java Doc)
public Connection getPhysicalConnection()(Code)(Java Doc)
protected void newConnectionHandle()(Code)(Java Doc)
public void removeConnectionEventListener(ConnectionEventListener listener)(Code)(Java Doc)
public void setLogger(Logger alog)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.