svn commit: r429598 - /incubator/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/WorkflowEngine.java

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

svn commit: r429598 - /incubator/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/WorkflowEngine.java

jonesde
Author: jonesde
Date: Mon Aug  7 23:30:40 2006
New Revision: 429598

URL: http://svn.apache.org/viewvc?rev=429598&view=rev
Log:
Changed to use TransactionUtil instead of the TransactionManager directly

Modified:
    incubator/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/WorkflowEngine.java

Modified: incubator/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/WorkflowEngine.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/WorkflowEngine.java?rev=429598&r1=429597&r2=429598&view=diff
==============================================================================
--- incubator/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/WorkflowEngine.java (original)
+++ incubator/ofbiz/trunk/framework/workflow/src/org/ofbiz/workflow/WorkflowEngine.java Mon Aug  7 23:30:40 2006
@@ -86,21 +86,13 @@
      * @see org.ofbiz.service.engine.GenericEngine#runAsync(java.lang.String, org.ofbiz.service.ModelService, java.util.Map, org.ofbiz.service.GenericRequester, boolean)
      */
     public void runAsync(String localName, ModelService modelService, Map context, GenericRequester requester, boolean persist) throws GenericServiceException {      
-        // Suspend the current transaction
-        TransactionManager tm = TransactionFactory.getTransactionManager();
-        if (tm == null) {
-            throw new GenericServiceException("Cannot get the transaction manager; cannot run persisted services.");
-        }
-
         Transaction parentTrans = null;
         boolean beganTransaction = false;
         try {
             try {
-                parentTrans = tm.suspend();                
+                parentTrans = TransactionUtil.suspend();
                 beganTransaction = TransactionUtil.begin();
                 //Debug.logInfo("Suspended transaction; began new: " + beganTransaction, module);
-            } catch (SystemException se) {
-                Debug.logError(se, "Cannot suspend transaction: " + se.getMessage(), module);
             } catch (GenericTransactionException e) {
                 Debug.logError(e, "Cannot begin nested transaction: " + e.getMessage(), module);
             }
@@ -275,12 +267,10 @@
             // Resume the parent transaction
             if (parentTrans != null) {
                 try {
-                    tm.resume(parentTrans);
+                    TransactionUtil.resume(parentTrans);
                     //Debug.logInfo("Resumed the parent transaction.", module);
-                } catch (InvalidTransactionException ite) {
-                    throw new GenericServiceException("Cannot resume transaction", ite);
-                } catch (SystemException se) {
-                    throw new GenericServiceException("Unexpected transaction error", se);
+                } catch (GenericTransactionException e) {
+                    throw new GenericServiceException("Could not resume transaction: " + e.toString(), e);
                 }
             }
         }