[jbpm-commits] JBoss JBPM SVN: r5640 - in jbpm3/branches/jbpm-3.2-soa/modules: core/src/main/java/org/jbpm/svc and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Sep 15 04:37:39 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-09-15 04:37:38 -0400 (Tue, 15 Sep 2009)
New Revision: 5640
Added:
jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/ExecuteJobsCommand.java
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java
Log:
SOA-1486 re-adding interface methods that were removed
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-09-14 20:26:29 UTC (rev 5639)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/db/JobSession.java 2009-09-15 08:37:38 UTC (rev 5640)
@@ -30,7 +30,7 @@
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.Session;
-
+import org.hibernate.criterion.Restrictions;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.graph.exe.Token;
import org.jbpm.job.Job;
@@ -251,4 +251,14 @@
}
}
+ public List loadJobs(long[] jobIds) {
+ int jobCount = jobIds.length;
+ Long[] jobs = new Long[jobCount];
+ for (int i = 0; i < jobCount; i++) {
+ jobs[i] = new Long(jobIds[i]);
+ }
+ return session.createCriteria(Job.class)
+ .add(Restrictions.in("id", jobs))
+ .list();
+ }
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java 2009-09-14 20:26:29 UTC (rev 5639)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/svc/Services.java 2009-09-15 08:37:38 UTC (rev 5640)
@@ -31,11 +31,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.jbpm.JbpmContext;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.logging.LoggingService;
import org.jbpm.msg.MessageService;
+import org.jbpm.persistence.JbpmPersistenceException;
import org.jbpm.persistence.PersistenceService;
import org.jbpm.persistence.db.DbPersistenceService;
import org.jbpm.persistence.db.StaleObjectLogConfigurer;
@@ -265,6 +265,10 @@
if (firstException != null) throw firstException;
}
+
+ public static boolean isCausedByStaleState(JbpmPersistenceException persistenceException) {
+ return DbPersistenceService.isLockingException(persistenceException);
+ }
public static void assignId(Object object) {
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
Added: jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/ExecuteJobsCommand.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/ExecuteJobsCommand.java (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/ExecuteJobsCommand.java 2009-09-15 08:37:38 UTC (rev 5640)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.ejb.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.JbpmContext;
+import org.jbpm.command.Command;
+import org.jbpm.util.ArrayUtil;
+
+/**
+ * Batch job processing command.
+ *
+ * @author Alejandro Guizar
+ */
+public class ExecuteJobsCommand implements Command {
+
+ private long[] jobIds;
+
+ private static final long serialVersionUID = 1L;
+ private static Log log = LogFactory.getLog(ExecuteJobsCommand.class);
+
+ public ExecuteJobsCommand(long[] jobIds) {
+ this.jobIds = jobIds;
+ }
+
+ public Object execute(JbpmContext jbpmContext) throws Exception {
+ log.debug("executing jobs " + ArrayUtil.toString(jobIds));
+ if (jobIds!=null) {
+ for (int jobId=0; jobId<jobIds.length; jobId++) {
+ ExecuteJobCommand executeJobCommand = new ExecuteJobCommand(jobId);
+ executeJobCommand.execute(jbpmContext);
+ }
+ }
+ return null;
+ }
+}
Property changes on: jbpm3/branches/jbpm-3.2-soa/modules/enterprise/src/main/java/org/jbpm/ejb/impl/ExecuteJobsCommand.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbpm-commits
mailing list