Java Doc for XAConnectionImpl.java in  » ERP-CRM-Financial » SourceTap-CRM » org » ofbiz » minerva » pool » jdbc » xa » wrapper » 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 » ERP CRM Financial » SourceTap CRM » org.ofbiz.minerva.pool.jdbc.xa.wrapper 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.ofbiz.minerva.pool.jdbc.xa.wrapper.XAConnectionImpl

XAConnectionImpl
public class XAConnectionImpl implements XAConnection,PooledObject(Code)
A transaction wrapper around a java.sql.Connection. This provides access to an XAResource (there is a one-to-one mapping between XAResource and XAConnection) and a java.sql.Connection (in this implementation, there is also a one-to-one mapping between XAConnection and java.sql.Connection). In order to pool java.sql.Connections in a transactional environment, this is the class that should be pooled - though you could pool the connections, there is no need to create and destroy these wrappers so frequently.

Note that there con only be one transaction at a time accessing one of these wrappers, and requests to a pool for multiple connections on behalf of one transaction should use the same wrapper. This is because there is no distinction between connections and transactions in a java.sql.Connection, and work done by one connection on behalf of a transaction would not be visible to another connection working on behalf of the same transaction - you would have effectively created two transactions.

This also implies that an XAConnection should not be released to a connection pool until the work has been committed or rolled back. However, it must sent the close notification as usual in order to be delisted from the transaction. So the ConnectionEventListener must not release the XAConnection to a pool when it receives the close event. Instead, it should also register a TransactionListener that will be notified when the Transaction is finished, and release the XAConnection at that time.


See Also:   org.ofbiz.minerva.pool.jdbc.xa.wrapper.TransactionListener
author:
   Aaron Mulder (ammulder@alumni.princeton.edu)
author:
   Bill Burke
author:
   REVISIONS:
author:
   20010703 bill added code for transaction isolation



Constructor Summary
public  XAConnectionImpl(Connection con, XAResourceImpl resource, boolean saveStackTrace)
     Creates a new transactional wrapper.

Method Summary
public  voidaddConnectionEventListener(ConnectionEventListener listener)
    
public  voidaddPoolEventListener(PoolEventListener listener)
    
public  voidclearTransactionListener()
     Clears the transaction listener.
public  voidclientConnectionClosed(XAClientConnection clientCon)
     Indicates that the connection given to the client has been closed. If there is currently a transaction, this object should not be closed or returned to a pool.
public  voidclose()
     Shuts down this wrapper (and the underlying Connection) permanently.
 voidfirePoolEvent(PoolEvent evt)
     Dispatches an event to the pool event listeners.
public  voidforceClientConnectionsClose()
    
public  ConnectiongetConnection()
    
public  intgetPSCacheSize()
     Gets the number of PreparedStatements to be cached for each Connection.
public  java.lang.StringgetPassword()
     Getter for property password.
public  java.lang.StringgetUser()
     Getter for property user.
public  XAResourcegetXAResource()
    
public  voidremoveConnectionEventListener(ConnectionEventListener listener)
    
public  voidremovePoolEventListener(PoolEventListener listener)
    
public  voidrollback()
     Rolls back the underlying connection.
public  voidsetConnectionError(SQLException e)
     Indicates that the connection given to the client has had an error. If there is currently a transaction, this object should not be closed or returned to a pool.
public  voidsetPSCacheSize(int maxSize)
     Sets the number of PreparedStatements to be cached for each Connection.
public  voidsetPassword(java.lang.String password)
     Setter for property password.
public  voidsetTransactionIsolation(int iso)
    
public  voidsetTransactionListener(TransactionListener tl)
     Sets the transaction listener.
public  voidsetUser(java.lang.String user)
     Setter for property user.
public  voidtransactionFailed()
     Indicates that the outstanding transaction has finished with a fatal error, and this object should be closed or permanently removed from a pool.
public  voidtransactionFinished()
     Indicates that the outstanding transaction has finished and this object can be closed or returned to a pool.


Constructor Detail
XAConnectionImpl
public XAConnectionImpl(Connection con, XAResourceImpl resource, boolean saveStackTrace)(Code)
Creates a new transactional wrapper.
Parameters:
  con - The underlying non-transactional Connection.
Parameters:
  resource - The transaction resource used to enlist thisconnection in a transaction.




Method Detail
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener listener)(Code)



addPoolEventListener
public void addPoolEventListener(PoolEventListener listener)(Code)



clearTransactionListener
public void clearTransactionListener()(Code)
Clears the transaction listener.



clientConnectionClosed
public void clientConnectionClosed(XAClientConnection clientCon)(Code)
Indicates that the connection given to the client has been closed. If there is currently a transaction, this object should not be closed or returned to a pool. If not, it can be closed or returned immediately.



close
public void close()(Code)
Shuts down this wrapper (and the underlying Connection) permanently.



firePoolEvent
void firePoolEvent(PoolEvent evt)(Code)
Dispatches an event to the pool event listeners.



forceClientConnectionsClose
public void forceClientConnectionsClose()(Code)



getConnection
public Connection getConnection()(Code)



getPSCacheSize
public int getPSCacheSize()(Code)
Gets the number of PreparedStatements to be cached for each Connection.



getPassword
public java.lang.String getPassword()(Code)
Getter for property password. Value of property password.



getUser
public java.lang.String getUser()(Code)
Getter for property user. Value of property user.



getXAResource
public XAResource getXAResource()(Code)



removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener listener)(Code)



removePoolEventListener
public void removePoolEventListener(PoolEventListener listener)(Code)



rollback
public void rollback() throws SQLException(Code)
Rolls back the underlying connection. This is used when there is no current transaction and the connection is returned to the pool - since no transaction will be committed or rolled back but this connection will be reused, we must roll it back. This is only done if autocommit is false.



setConnectionError
public void setConnectionError(SQLException e)(Code)
Indicates that the connection given to the client has had an error. If there is currently a transaction, this object should not be closed or returned to a pool. If not, it can be closed or returned immediately.



setPSCacheSize
public void setPSCacheSize(int maxSize)(Code)
Sets the number of PreparedStatements to be cached for each Connection. Your DB product may impose a limit on the number of open PreparedStatements.



setPassword
public void setPassword(java.lang.String password)(Code)
Setter for property password.
Parameters:
  password - New value of property password.



setTransactionIsolation
public void setTransactionIsolation(int iso) throws SQLException(Code)



setTransactionListener
public void setTransactionListener(TransactionListener tl)(Code)
Sets the transaction listener.



setUser
public void setUser(java.lang.String user)(Code)
Setter for property user.
Parameters:
  user - New value of property user.



transactionFailed
public void transactionFailed()(Code)
Indicates that the outstanding transaction has finished with a fatal error, and this object should be closed or permanently removed from a pool. This dispatches a close event to all listeners.
See Also:   XAConnectionImpl.addConnectionEventListener



transactionFinished
public void transactionFinished()(Code)
Indicates that the outstanding transaction has finished and this object can be closed or returned to a pool. This dispatches a close event to all listeners.
See Also:   XAConnectionImpl.addConnectionEventListener



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)

w__w__w_.ja___v___a_2__s_._co_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.