svn commit: r537059 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r537059 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java

jaz-3
Author: jaz
Date: Thu May 10 18:05:28 2007
New Revision: 537059

URL: http://svn.apache.org/viewvc?view=rev&rev=537059
Log:
fixed, to make sure the real transaction is used to get status; previous to this commit the new thread wasn't associated with a transaction

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java?view=diff&rev=537059&r1=537058&r2=537059
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java Thu May 10 18:05:28 2007
@@ -32,6 +32,7 @@
 
     public static final String module = GenericXaResource.class.getName();
 
+    protected Transaction trans = null;
     protected boolean active = false;
     protected int timeout = 30;
     protected Xid xid = null;
@@ -46,6 +47,7 @@
             if (tm != null && tm.getStatus() == Status.STATUS_ACTIVE) {
                 Transaction tx = tm.getTransaction();
                 if (tx != null) {
+                    this.setTransaction(tx);
                     tx.enlistResource(this);
                 } else {
                     throw new XAException(XAException.XAER_NOTA);
@@ -154,6 +156,14 @@
         return true;
     }
 
+    public Transaction getTransaction() {
+        return this.trans;
+    }
+
+    public void setTransaction(Transaction t) {
+        this.trans = t;
+    }
+
     public Xid getXid() {
         return this.xid;
     }
@@ -183,10 +193,12 @@
             if (active) {
                 // get the current status
                 int status = Status.STATUS_UNKNOWN;
-                try {
-                    status = TransactionUtil.getStatus();
-                } catch (GenericTransactionException e) {
-                    Debug.logWarning(e, module);
+                if (trans != null) {
+                    try {
+                        status = trans.getStatus();
+                    } catch (SystemException e) {
+                        Debug.logWarning(e, module);
+                    }
                 }
 
                 // log a warning message