[jboss-svn-commits] JBL Code SVN: r29273 - labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 9 07:32:48 EDT 2009
Author: kevin.conner at jboss.com
Date: 2009-09-09 07:32:47 -0400 (Wed, 09 Sep 2009)
New Revision: 29273
Added:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/JobUtil.java
Modified:
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteJobCommand.java
labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteTimerCommand.java
Log:
Fix handling of deleted jobs/timers: JBESB-2817
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteJobCommand.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteJobCommand.java 2009-09-09 10:45:13 UTC (rev 29272)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteJobCommand.java 2009-09-09 11:32:47 UTC (rev 29273)
@@ -72,7 +72,7 @@
public Object execute(JbpmContext jbpmContext) throws Exception {
JobSession jobSession = jbpmContext.getJobSession();
Job job = jobSession.getJob(jobId);
- if (job == null) {
+ if (JobUtil.isDeleted(job)) {
if (log.isDebugEnabled()) {
log.debug("job " + jobId + " was deleted");
}
Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteTimerCommand.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteTimerCommand.java 2009-09-09 10:45:13 UTC (rev 29272)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/ExecuteTimerCommand.java 2009-09-09 11:32:47 UTC (rev 29273)
@@ -58,6 +58,12 @@
*/
public Object execute(JbpmContext jbpmContext) throws Exception {
Timer timer = jbpmContext.getJobSession().loadTimer(timerId);
+ if (JobUtil.isDeleted(timer)) {
+ if (log.isDebugEnabled()) {
+ log.debug("timer " + timerId + " was deleted");
+ }
+ return null;
+ }
if (timer.isSuspended()) {
if (log.isDebugEnabled()) {
log.debug(timer + " is suspended");
Added: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/JobUtil.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/JobUtil.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/JobUtil.java 2009-09-09 11:32:47 UTC (rev 29273)
@@ -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.jboss.soa.esb.services.jbpm.integration.job;
+
+import org.jbpm.job.Job;
+
+/**
+ * Job utility methods used by the commands.
+ * @author Kevin Conner
+ */
+class JobUtil
+{
+ /**
+ * Has the job been deleted?
+ * @param job The job to test.
+ * @return true if deleted, false otherwise.
+ */
+ static boolean isDeleted(final Job job)
+ {
+ /*
+ * The jBPM code tests for null but lazy loading means
+ * that a proxy is returned and that an exception will be
+ * raised when accessed. We test for both assumptions here,
+ * just to be safe.
+ */
+ if (job != null)
+ {
+ try
+ {
+ job.getLockOwner() ;
+ return false ;
+ }
+ catch (final Exception ex) {} // ignore
+ }
+ return true ;
+ }
+}
Property changes on: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/services/jbpm/src/main/java/org/jboss/soa/esb/services/jbpm/integration/job/JobUtil.java
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
More information about the jboss-svn-commits
mailing list