Java Doc for XAResourceImpl.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.XAResourceImpl

XAResourceImpl
public class XAResourceImpl implements XAResource(Code)
JTA resource implementation for JDBC 1.0 connections. This is somewhat limited in two respects. First, it does not support two-phase commits since JDBC 1.0 does not. It will operate in the presence of two-phase commits, but will throw heuristic exceptions if there is a failure during a commit or rollback. Second, it can only be associated with one transaction at a time, and will throw exceptions if a second transaction tries to attach before the first has called commit, rollback, or forget.

Warning:

This implementation assumes that forget will be called after a failed commit or rollback. Otherwise, the database connection will never be closed.


author:
   Aaron Mulder (ammulder@alumni.princeton.edu)



Constructor Summary
public  XAResourceImpl(Connection con)
     Creates a new instance as the transactional resource for the specified underlying connection.

Method Summary
public  voidclose()
     Closes this instance permanently.
public  voidcommit(Xid id, boolean twoPhase)
     Commits a transaction.
throws:
  XAException - Occurs when the state was not correct (end never called), thetransaction ID is wrong, the connection was set to Auto-Commit,or the commit on the underlying connection fails.
public  voidend(Xid id, int flags)
     Dissociates a resource from a global transaction.
public  voidforget(Xid id)
     Indicates that no further action will be taken on behalf of this transaction (after a heuristic failure).
public  intgetTransactionTimeout()
     Gets the transaction timeout.
public  XAConnectionImplgetXAConnection()
    
public  booleanisSameRM(XAResource res)
     Since the concept of resource managers does not really apply here (all JDBC connections must be managed individually), indicates whether the specified resource is the same as this one.
public  booleanisTransaction()
     Gets whether there is outstanding work on behalf of a Transaction.
public  intprepare(Xid id)
     Prepares a transaction to commit.
public  Xid[]recover(int flag)
     Returns all transaction IDs where work was done with no corresponding commit, rollback, or forget.
public  voidrollback(Xid id)
     Rolls back the work, assuming it was done on behalf of the specified transaction.
throws:
  XAException - Occurs when the state was not correct (end never called), thetransaction ID is wrong, the connection was set to Auto-Commit,or the rollback on the underlying connection fails.
public  booleansetTransactionTimeout(int timeout)
     Sets the transaction timeout.
 voidsetXAConnection(XAConnectionImpl xaCon)
     Sets the XAConnection associated with this XAResource.
public  voidstart(Xid id, int flags)
     Associates a JDBC connection with a global transaction.
protected  voidthrowXAException(int code)
    
protected  voidthrowXAException(String msg)
    


Constructor Detail
XAResourceImpl
public XAResourceImpl(Connection con)(Code)
Creates a new instance as the transactional resource for the specified underlying connection.




Method Detail
close
public void close()(Code)
Closes this instance permanently.



commit
public void commit(Xid id, boolean twoPhase) throws XAException(Code)
Commits a transaction.
throws:
  XAException - Occurs when the state was not correct (end never called), thetransaction ID is wrong, the connection was set to Auto-Commit,or the commit on the underlying connection fails. The error codediffers depending on the exact situation.



end
public void end(Xid id, int flags) throws XAException(Code)
Dissociates a resource from a global transaction.
throws:
  XAException - Occurs when the state was not correct (end called twice), or thetransaction ID is wrong.



forget
public void forget(Xid id) throws XAException(Code)
Indicates that no further action will be taken on behalf of this transaction (after a heuristic failure). It is assumed this will be called after a failed commit or rollback.
throws:
  XAException - Occurs when the state was not correct (end never called), or thetransaction ID is wrong.



getTransactionTimeout
public int getTransactionTimeout() throws XAException(Code)
Gets the transaction timeout.



getXAConnection
public XAConnectionImpl getXAConnection()(Code)



isSameRM
public boolean isSameRM(XAResource res) throws XAException(Code)
Since the concept of resource managers does not really apply here (all JDBC connections must be managed individually), indicates whether the specified resource is the same as this one.



isTransaction
public boolean isTransaction()(Code)
Gets whether there is outstanding work on behalf of a Transaction. If there is not, then a connection that is closed will cause the XAConnection to be closed or returned to a pool. If there is, then the XAConnection must be kept open until commit or rollback is called.



prepare
public int prepare(Xid id) throws XAException(Code)
Prepares a transaction to commit. Since JDBC 1.0 does not support 2-phase commits, this claims the commit is OK (so long as some work was done on behalf of the specified transaction).
throws:
  XAException - Occurs when the state was not correct (end never called), thetransaction ID is wrong, or the connection was set to Auto-Commit.



recover
public Xid[] recover(int flag) throws javax.transaction.xa.XAException(Code)
Returns all transaction IDs where work was done with no corresponding commit, rollback, or forget. Not really sure why this is useful in the context of JDBC drivers.



rollback
public void rollback(Xid id) throws XAException(Code)
Rolls back the work, assuming it was done on behalf of the specified transaction.
throws:
  XAException - Occurs when the state was not correct (end never called), thetransaction ID is wrong, the connection was set to Auto-Commit,or the rollback on the underlying connection fails. The error codediffers depending on the exact situation.



setTransactionTimeout
public boolean setTransactionTimeout(int timeout) throws XAException(Code)
Sets the transaction timeout. This is saved, but the value is not used by the current implementation.



setXAConnection
void setXAConnection(XAConnectionImpl xaCon)(Code)
Sets the XAConnection associated with this XAResource. This is required, but both classes cannot include an instance of the other in their constructor!
throws:
  java.lang.IllegalStateException - Occurs when this is called more than once.



start
public void start(Xid id, int flags) throws XAException(Code)
Associates a JDBC connection with a global transaction. We assume that end will be called followed by prepare, commit, or rollback. If start is called after end but before commit or rollback, there is no way to distinguish work done by different transactions on the same connection). If start is called more than once before end, either it's a duplicate transaction ID or illegal transaction ID (since you can't have two transactions associated with one DB connection).
throws:
  XAException - Occurs when the state was not correct (start called twice), thetransaction ID is wrong, or the instance has already been closed.



throwXAException
protected void throwXAException(int code) throws XAException(Code)



throwXAException
protected void throwXAException(String msg) throws XAException(Code)



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__._j__ava_2_s_.__c__o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.