[jbpm-commits] JBoss JBPM SVN: r2405 - jbpm3/branches/aguizar/modules/core/src/main/java/org/jbpm/job/executor.

do-not-reply at jboss.org do-not-reply at jboss.org
Sat Sep 27 01:25:27 EDT 2008


Author: alex.guizar at jboss.com
Date: 2008-09-27 01:25:27 -0400 (Sat, 27 Sep 2008)
New Revision: 2405

Modified:
   jbpm3/branches/aguizar/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
Log:
have job executor thread rollback on persistence exception

Modified: jbpm3/branches/aguizar/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java
===================================================================
--- jbpm3/branches/aguizar/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java	2008-09-27 04:36:31 UTC (rev 2404)
+++ jbpm3/branches/aguizar/modules/core/src/main/java/org/jbpm/job/executor/JobExecutorThread.java	2008-09-27 05:25:27 UTC (rev 2405)
@@ -10,6 +10,8 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.hibernate.HibernateException;
+
 import org.jbpm.JbpmConfiguration;
 import org.jbpm.JbpmContext;
 import org.jbpm.db.JobSession;
@@ -164,6 +166,11 @@
         if (job.execute(jbpmContext)) {
           jobSession.deleteJob(job);
         }
+      } catch (HibernateException e) {
+        log.debug("exception while executing " + job, e);
+        // allowing a transaction to proceed after a persistence exception is unsafe
+        // TODO rollback on *any* runtime exception?
+        jbpmContext.setRollbackOnly();
       } catch (Exception e) {
         log.debug("exception while executing " + job, e);
         StringWriter memoryWriter = new StringWriter();




More information about the jbpm-commits mailing list