Author: jonesde
Date: Mon Sep 17 19:09:52 2007
New Revision: 576661

URL: http://svn.apache.org/viewvc?rev=576661&view=rev
Log:
A small change to make it possible to attach these to a transaction other than 
the currently active one (like a paused one, for example)

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?rev=576661&r1=576660&r2=576661&view=diff
==============================================================================
--- 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java
 (original)
+++ 
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/GenericXaResource.java
 Mon Sep 17 19:09:52 2007
@@ -47,14 +47,26 @@
         try {
             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);
-                }
+                this.enlist(tx);
             } else {
                 throw new XAException("No transaction manager or invalid 
status");
+            }
+        } catch (SystemException e) {
+            throw new XAException("Unable to get transaction status");
+        }
+    }
+
+    /**
+     * Enlists this resource in the current transaction
+     * @throws XAException
+     */
+    public void enlist(Transaction tx) throws XAException {
+        try {
+            if (tx != null) {
+                this.setTransaction(tx);
+                tx.enlistResource(this);
+            } else {
+                throw new XAException(XAException.XAER_NOTA);
             }
         } catch (SystemException e) {
             throw new XAException("Unable to get transaction status");


Reply via email to