You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mr...@apache.org on 2007/02/12 02:54:48 UTC

svn commit: r506217 - in /incubator/ode/trunk: bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/ bpel-scheduler-quartz/src/main/java/org/apach...

Author: mriou
Date: Sun Feb 11 17:54:47 2007
New Revision: 506217

URL: http://svn.apache.org/viewvc?view=rev&rev=506217
Log:
The hydration can happen both from the Management API (non transacted, need to start one) or from the IL (transacted, just using current).

Modified:
    incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
    incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
    incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java
    incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/scheduler/TestScheduler.java

Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java?view=diff&rev=506217&r1=506216&r2=506217
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java Sun Feb 11 17:54:47 2007
@@ -90,6 +90,11 @@
             throws Exception, ContextException;
 
     /**
+     * @return true if the current thread is associated with a transaction.
+     */
+    boolean isTransacted();
+
+    /**
      * Register a transaction synchronizer.
      * @param synch synchronizer
      * @throws ContextException

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?view=diff&rev=506217&r1=506216&r2=506217
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java Sun Feb 11 17:54:47 2007
@@ -377,7 +377,24 @@
     public void hydrated(final BpelProcess process) {
         // Recreating the process DAO if the definition has changed, shouldn't do anything
         // except after a redeploy
-        bounceProcessDAO(_contexts.dao.getConnection(), process.getPID(), process._pconf.getVersion(), process.getOProcess());
+        if (_contexts.scheduler.isTransacted())
+            bounceProcessDAO(_contexts.dao.getConnection(), process.getPID(),
+                    process._pconf.getVersion(), process.getOProcess());
+        else {
+            try {
+                _db.exec(new BpelDatabase.Callable<Object>() {
+                    public Object run(BpelDAOConnection conn) throws Exception {
+                        bounceProcessDAO(conn, process.getPID(),
+                                process._pconf.getVersion(), process.getOProcess());
+                        return null;
+                    }
+                });
+            } catch (Exception ex) {
+                String errmsg = "DbError";
+                __log.error(errmsg, ex);
+                throw new BpelEngineException(errmsg, ex);
+            }
+        }
 
         _runningProcesses.add(process);
     }

Modified: incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java?view=diff&rev=506217&r1=506216&r2=506217
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/test/java/org/apache/ode/bpel/runtime/MockBpelServer.java Sun Feb 11 17:54:47 2007
@@ -307,6 +307,10 @@
             return _quartz.execIsolatedTransaction(transaction);
         }
 
+        public boolean isTransacted() {
+            return _quartz.isTransacted();
+        }
+
         public void start() { _quartz.start(); }
         public void stop() { _quartz.stop(); }
         public void shutdown() { _quartz.shutdown(); }

Modified: incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java?view=diff&rev=506217&r1=506216&r2=506217
==============================================================================
--- incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java (original)
+++ incubator/ode/trunk/bpel-scheduler-quartz/src/main/java/org/apache/ode/bpel/scheduler/quartz/QuartzSchedulerImpl.java Sun Feb 11 17:54:47 2007
@@ -39,6 +39,7 @@
 import javax.sql.DataSource;
 import javax.transaction.Status;
 import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
 import javax.transaction.TransactionManager;
 import java.sql.Connection;
 import java.util.Collections;
@@ -270,6 +271,16 @@
                 return execTransaction(transaction);
             }
         });
+    }
+
+    public boolean isTransacted() {
+        try {
+            return _txm.getStatus() != Status.STATUS_NO_TRANSACTION;
+        } catch (SystemException e) {
+            String errmsg = "Failed to get transaction status.";
+            __log.error(errmsg, e);
+            throw new ContextException(errmsg, e);
+        }
     }
 
     protected void rollback() throws Exception {

Modified: incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/scheduler/TestScheduler.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/scheduler/TestScheduler.java?view=diff&rev=506217&r1=506216&r2=506217
==============================================================================
--- incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/scheduler/TestScheduler.java (original)
+++ incubator/ode/trunk/bpel-test/src/main/java/org/apache/ode/test/scheduler/TestScheduler.java Sun Feb 11 17:54:47 2007
@@ -71,6 +71,10 @@
         return future;
     }
 
+    public boolean isTransacted() {
+        return false;
+    }
+
     public void start() {
     }