[jbpm-commits] JBoss JBPM SVN: r6684 - jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Sep 26 00:37:49 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-09-26 00:37:48 -0400 (Sun, 26 Sep 2010)
New Revision: 6684

Added:
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/ExecuteJobCommand.java
   projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath
Removed:
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java
Modified:
   jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/perf/PerformanceTest.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java
   jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java
   jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java
Log:
JBPM-2945 fix repetitive timers expiring only once;
re-enable testScheduleFork; increase testPerformance timeout

Modified: jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/perf/PerformanceTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/perf/PerformanceTest.java	2010-09-26 00:44:51 UTC (rev 6683)
+++ jbpm3/branches/jbpm-3.2-soa/core/src/test/java/org/jbpm/perf/PerformanceTest.java	2010-09-26 04:37:48 UTC (rev 6684)
@@ -56,24 +56,14 @@
     deployProcessDefinition(processDefinition);
   }
 
-  public void testAsyncCall() {
-    Runtime rt = Runtime.getRuntime();
-    System.out.print("Free memory: ");
-    System.out.println(rt.freeMemory());
-    System.out.print("Total memory: ");
-    System.out.println(rt.totalMemory());
-    System.out.print("Max memory: ");
-    System.out.println(rt.maxMemory());
-    System.out.print("Processors: ");
-    System.out.println(rt.availableProcessors());
-    
+  public void testPerformance() {
     long firstTime = System.currentTimeMillis();
     launchProcessInstances(WARMUP_INSTANCES);
     processJobs(TIMEOUT);
 
     long secondTime = System.currentTimeMillis();
     launchProcessInstances(MEASURED_INSTANCES);
-    processJobs((secondTime - firstTime) * (MEASURED_INSTANCES / WARMUP_INSTANCES + 1));
+    processJobs((secondTime - firstTime) * (MEASURED_INSTANCES / WARMUP_INSTANCES) * 2);
 
     long duration = System.currentTimeMillis() - secondTime;
     System.out.println("### Processed "

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java	2010-09-26 00:44:51 UTC (rev 6683)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/AbstractEnterpriseTestCase.java	2010-09-26 04:37:48 UTC (rev 6684)
@@ -58,10 +58,10 @@
 
   private List processDefinitions = new ArrayList();
 
+  private final Log log = LogFactory.getLog(getClass());
+
   private static Context environment;
 
-  private static final Log log = LogFactory.getLog(AbstractEnterpriseTestCase.class);
-
   protected AbstractEnterpriseTestCase() {
   }
 

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java	2010-09-26 00:44:51 UTC (rev 6683)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise/src/test/java/org/jbpm/enterprise/ejbtimer/EjbSchedulerTest.java	2010-09-26 04:37:48 UTC (rev 6684)
@@ -199,9 +199,6 @@
   }
 
   public void testScheduleFork() throws Exception {
-    // [JBPM-2916] temporarily exclude this test from the suite
-    if (true) return;
-
     deployProcessDefinition("<process-definition name='fork'>"
       + "  <event type='process-end'>"
       + "    <action expression='#{eventCallback.processEnd}'/>"

Deleted: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java	2010-09-26 00:44:51 UTC (rev 6683)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java	2010-09-26 04:37:48 UTC (rev 6684)
@@ -1,110 +0,0 @@
-/*
- * 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.graph.exe.ProcessInstance;
-import org.jbpm.job.Job;
-import org.jbpm.job.Timer;
-import org.jbpm.scheduler.SchedulerService;
-
-/**
- * Individual job processing command.
- * 
- * @author Alejandro Guizar
- */
-public class ExecuteJobCommand implements Command {
-
-  private final long jobId;
-
-  private static final long serialVersionUID = 1L;
-  private static final Log log = LogFactory.getLog(ExecuteJobCommand.class.getName());
-
-  public ExecuteJobCommand(long jobId) {
-    this.jobId = jobId;
-  }
-
-  public Object execute(JbpmContext jbpmContext) throws Exception {
-    Job job = acquireJob(jobId, jbpmContext);
-    if (job != null) executeJob(job, jbpmContext);
-    return job;
-  }
-
-  private static Job acquireJob(long jobId, JbpmContext jbpmContext) {
-    boolean debug = log.isDebugEnabled();
-    if (debug) log.debug("acquiring job: " + jobId);
-    Job job = jbpmContext.getJobSession().getJob(jobId);
-
-    // job could have been deleted manually
-    // or by ending the process instance
-    if (job != null) {
-      // register process instance for automatic save
-      // see https://jira.jboss.org/jira/browse/JBPM-1015
-      ProcessInstance processInstance = job.getProcessInstance();
-      jbpmContext.addAutoSaveProcessInstance(processInstance);
-
-      // if job is exclusive, lock process instance
-      if (job.isExclusive()) {
-        jbpmContext.getGraphSession().lockProcessInstance(processInstance);
-      }
-
-      // mark job as locked to prevent it from being deleted
-      job.setLockOwner(Thread.currentThread().getName());
-      if (debug) log.debug("acquired " + job);
-    }
-    else {
-      log.warn("job not found: " + jobId);
-    }
-
-    return job;
-  }
-
-  private static void executeJob(Job job, JbpmContext jbpmContext) throws Exception {
-    if (log.isDebugEnabled()) log.debug("executing " + job);
-    if (job.execute(jbpmContext)) {
-      if (job instanceof Timer) {
-        Timer timer = (Timer) job;
-        SchedulerService schedulerService = jbpmContext.getServices().getSchedulerService();
-        // if the timer has repeat
-        if (timer.getRepeat() != null) {
-          // create a new timer
-          if (log.isDebugEnabled()) {
-            log.debug("scheduling timer for repeat on " + timer.getDueDate());
-          }
-          schedulerService.createTimer(timer);
-        }
-        else {
-          // clear timer
-          schedulerService.deleteTimer((Timer) job);
-        }
-      }
-      else {
-        // clear job
-        jbpmContext.getJobSession().deleteJob(job);
-      }
-    }
-  }
-}

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java	2010-09-26 00:44:51 UTC (rev 6683)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/JobListenerBean.java	2010-09-26 04:37:48 UTC (rev 6684)
@@ -10,6 +10,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import org.jbpm.command.Command;
+import org.jbpm.jms.ExecuteJobCommand;
 
 /**
  * Message-driven bean that listens for {@link Message messages} containing a reference to a

Copied: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/ExecuteJobCommand.java (from rev 6683, jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/ejb/impl/ExecuteJobCommand.java)
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/ExecuteJobCommand.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/ExecuteJobCommand.java	2010-09-26 04:37:48 UTC (rev 6684)
@@ -0,0 +1,97 @@
+/*
+ * 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.jms;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jbpm.JbpmContext;
+import org.jbpm.command.Command;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.job.Job;
+import org.jbpm.job.Timer;
+
+/**
+ * Individual job processing command.
+ * 
+ * @author Alejandro Guizar
+ */
+public class ExecuteJobCommand implements Command {
+
+  private final long jobId;
+
+  private static final long serialVersionUID = 1L;
+  private static final Log log = LogFactory.getLog(ExecuteJobCommand.class);
+
+  public ExecuteJobCommand(long jobId) {
+    this.jobId = jobId;
+  }
+
+  public Object execute(JbpmContext jbpmContext) throws Exception {
+    Job job = acquireJob(jobId, jbpmContext);
+    if (job != null) executeJob(job, jbpmContext);
+    return job;
+  }
+
+  private static Job acquireJob(long jobId, JbpmContext jbpmContext) {
+    boolean debug = log.isDebugEnabled();
+    if (debug) log.debug("acquiring job: " + jobId);
+    Job job = jbpmContext.getJobSession().getJob(jobId);
+
+    // job could have been deleted manually
+    // or by ending the process instance
+    if (job != null) {
+      // register process instance for automatic save
+      // see https://jira.jboss.org/jira/browse/JBPM-1015
+      ProcessInstance processInstance = job.getProcessInstance();
+      jbpmContext.addAutoSaveProcessInstance(processInstance);
+
+      // if job is exclusive, lock process instance
+      if (job.isExclusive()) {
+        jbpmContext.getGraphSession().lockProcessInstance(processInstance);
+      }
+
+      // mark job as locked to prevent it from being deleted
+      job.setLockOwner(Thread.currentThread().getName());
+      if (debug) log.debug("acquired " + job);
+    }
+    else {
+      log.warn("job not found: " + jobId);
+    }
+
+    return job;
+  }
+
+  private static void executeJob(Job job, JbpmContext jbpmContext) throws Exception {
+    if (log.isDebugEnabled()) log.debug("executing " + job);
+    if (job.execute(jbpmContext)) {
+      // clear job
+      jbpmContext.getJobSession().deleteJob(job);
+    }
+    else {
+      // job is a repetitive timer
+      Timer timer = jbpmContext.getJobSession().loadTimer(job.getId());
+      JmsConnectorService schedulerService = (JmsConnectorService) jbpmContext.getServices().getSchedulerService();
+      schedulerService.sendWithoutSaving(timer);
+    }
+  }
+}

Modified: jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java	2010-09-26 00:44:51 UTC (rev 6683)
+++ jbpm3/branches/jbpm-3.2-soa/enterprise-jee5/src/main/java/org/jbpm/jms/JmsConnectorService.java	2010-09-26 04:37:48 UTC (rev 6684)
@@ -73,7 +73,10 @@
 
   public void send(Job job) {
     jobSession.saveJob(job);
+    sendWithoutSaving(job);
+  }
 
+  void sendWithoutSaving(Job job) {
     try {
       Message message = session.createMessage();
       populateMessage(message, job);

Added: projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath
===================================================================
--- projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath	                        (rev 0)
+++ projects/jsf-console/branches/jsf-console-3.2-soa/console-jee5/.classpath	2010-09-26 04:37:48 UTC (rev 6684)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>



More information about the jbpm-commits mailing list