[jbpm-users] [jBPM Users] - Re: Only Sync Fork Join working after Multiplicity fix

mmusaji do-not-reply at jboss.com
Wed Sep 23 10:04:57 EDT 2009


I forgot to add the test without the syn that works ok.


  | package org.workflow.test.forum;
  | 
  | import org.jbpm.api.Execution;
  | import org.jbpm.api.activity.ActivityBehaviour;
  | import org.jbpm.api.activity.ActivityExecution;
  | import org.jbpm.test.JbpmTestCase;
  | 
  | public class JoinTestApp extends JbpmTestCase{
  |     String deploymentDbid;
  | 
  |     protected void setUp() throws Exception {
  |         super.setUp();
  |     }
  | 
  |     protected void tearDown() throws Exception {
  |         repositoryService.deleteDeploymentCascade(deploymentDbid);
  |         super.tearDown();
  |     }
  | 
  |     public void testJoinASync() throws Exception {
  |         deploymentDbid = repositoryService.createDeployment()
  |         .addResourceFromClasspath("org/workflow/test/forum/aSyncProcessCustom.jpdl.xml")
  |         .deploy();
  | 
  |         String processInstanceId = executionService.startProcessInstanceByKey("aSyncProcessCustom").getId();
  |         assertNotNull(processInstanceId);
  | 
  |         Thread.sleep(4000);
  |        
  |         assertProcessInstanceEnded(processInstanceId);
  |     }
  |     public static class CustomOneClass implements ActivityBehaviour {
  |         private static final long serialVersionUID = 1L;
  | 
  |         public void execute(ActivityExecution execution) throws Exception {
  |             System.out.println("Executing");
  | 
  |             System.out.println(execution.getActivityName());
  | 
  |             execution.takeDefaultTransition();
  |         }
  |     }
  | 
  |     public static class CustomTwoClass implements ActivityBehaviour {
  |         private static final long serialVersionUID = 1L;
  | 
  |         public void execute(ActivityExecution execution) throws Exception {
  |             System.out.println("Executing");
  | 
  |             System.out.println(execution.getActivityName());
  | 
  |             execution.takeDefaultTransition();
  |         }
  |     }
  | 
  |     public static class CustomThreeClass implements ActivityBehaviour {
  |         private static final long serialVersionUID = 1L;
  | 
  |         public void execute(ActivityExecution execution) throws Exception {
  |             System.out.println("Executing");
  | 
  |             System.out.println(execution.getActivityName());
  | 
  |             execution.takeDefaultTransition();
  |         }
  |     }
  | 
  |     public static class CustomFourClass implements ActivityBehaviour {
  |         private static final long serialVersionUID = 1L;
  | 
  |         public void execute(ActivityExecution execution) throws Exception {
  |             System.out.println("Executing");
  | 
  |             System.out.println(execution.getActivityName());
  | 
  |             execution.takeDefaultTransition();
  |         }
  | 
  |     }
  | 
  | }
  | 

Process Definition (NB. with no async nodes)


  | <process name="aSyncProcessCustom"> 
  |   <start> 
  |     <transition to="theFork" /> 
  |   </start> 
  |   <fork name="theFork"> 
  |     <transition to="customOne" /> 
  |     <transition to="customTwo" /> 
  |     <transition to="customThree" /> 
  |   </fork> 
  |   <custom name="customOne" class="org.workflow.test.forum.JoinTestApp$CustomOneClass">
  |      <transition to="join"/>
  |    </custom>
  |    <custom name="customTwo" class="org.workflow.test.forum.JoinTestApp$CustomTwoClass">
  |      <transition to="join"/>
  |    </custom> 
  |    <custom name="customThree" class="org.workflow.test.forum.JoinTestApp$CustomThreeClass">
  |      <transition to="join"/>
  |    </custom>
  |   <join name="join"> 
  |     <transition to="customFour" /> 
  |   </join> 
  |   <custom name="customFour" class="org.workflow.test.forum.JoinTestApp$CustomFourClass">
  |      <transition to="end"/>
  |    </custom>
  |   <end name="end" /> 
  | </process>
  | 

Output... please note that customFour is executed.


  | 15:02:53,799 FIN | [BaseJbpmTestCase] === starting testJoinASync =============================
  | 15:02:53,940 FIN | [WireContext] eagerly initializing org.jbpm.pvm.internal.jobexecutor.JobExecutor
  | 15:02:53,956 INF   | [DispatcherThread] starting DispatcherThread
  | log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
  | log4j:WARN Please initialize the log4j system properly.
  | 15:02:55,018 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:55,034 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:55,034 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:55,049 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:55,049 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:55,221 FIN | [ProcessDefinitionImpl] creating new execution for process 'aSyncProcessCustom'
  | 15:02:55,237 FIN | [DefaultIdGenerator] generated execution id aSyncProcessCustom.25
  | 15:02:55,237 FIN | [ExecuteActivity] executing activity(7819553)
  | 15:02:55,237 FIN | [ExecuteActivity] executing activity(theFork)
  | Executing
  | customOne
  | Executing
  | customTwo
  | Executing
  | customThree
  | 15:02:55,237 FIN | [DefaultIdGenerator] generated execution id aSyncProcessCustom.25.26
  | 15:02:55,237 FIN | [ExecutionImpl] created execution[aSyncProcessCustom.25.26]
  | 15:02:55,237 FIN | [ExecuteActivity] executing activity(customOne)
  | 15:02:55,237 FIN | [ExecuteActivity] executing activity(join)
  | 15:02:55,253 FIN | [DefaultIdGenerator] generated execution id aSyncProcessCustom.25.27
  | 15:02:55,253 FIN | [ExecutionImpl] created execution[aSyncProcessCustom.25.27]
  | 15:02:55,253 FIN | [ExecuteActivity] executing activity(customTwo)
  | 15:02:55,253 FIN | [ExecuteActivity] executing activity(join)
  | 15:02:55,253 FIN | [DefaultIdGenerator] generated execution id aSyncProcessCustom.25.28
  | Executing
  | customFour
  | 15:02:55,253 FIN | [ExecutionImpl] created execution[aSyncProcessCustom.25.28]
  | 15:02:55,253 FIN | [ExecuteActivity] executing activity(customThree)
  | 15:02:55,253 FIN | [ExecuteActivity] executing activity(join)
  | 15:02:55,253 FIN | [ExecutionImpl] execution[aSyncProcessCustom.25.26] ends
  | 15:02:55,253 FIN | [ExecutionImpl] execution[aSyncProcessCustom.25.27] ends
  | 15:02:55,253 FIN | [ExecutionImpl] execution[aSyncProcessCustom.25.28] ends
  | 15:02:55,253 FIN | [ExecuteActivity] executing activity(customFour)
  | 15:02:55,253 FIN | [ExecuteActivity] executing activity(end)
  | 15:02:55,253 FIN | [ExecutionImpl] execution[aSyncProcessCustom.25] ends
  | 15:02:55,268 FIN | [DbSessionImpl] deleting process instance aSyncProcessCustom.25
  | 15:02:55,659 FIN   | [DispatcherThread] DispatcherThread woke up
  | 15:02:55,659 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:55,659 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:55,659 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:55,659 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:55,659 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:56,253 FIN   | [DispatcherThread] DispatcherThread woke up
  | 15:02:56,253 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:56,253 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:56,253 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:56,253 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:56,253 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:56,862 FIN   | [DispatcherThread] DispatcherThread woke up
  | 15:02:56,862 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:56,862 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:56,862 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:56,862 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:56,862 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:57,456 FIN   | [DispatcherThread] DispatcherThread woke up
  | 15:02:57,456 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:57,471 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:57,471 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:57,471 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:57,471 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:58,065 FIN   | [DispatcherThread] DispatcherThread woke up
  | 15:02:58,065 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:58,065 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:58,065 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:58,065 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:58,065 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:58,674 FIN   | [DispatcherThread] DispatcherThread woke up
  | 15:02:58,674 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:58,674 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:58,674 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:58,674 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:58,674 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:59,268 FIN   | [DispatcherThread] DispatcherThread woke up
  | 15:02:59,268 FIN   | [AcquireJobsCmd] start querying first acquirable job...
  | 15:02:59,268 FIN   | [AcquireJobsCmd] locking jobs []
  | 15:02:59,268 FIN   | [GetNextDueDateCmd] getting next due date...
  | 15:02:59,268 FIN   | [GetNextDueDateCmd] next due date is null
  | 15:02:59,268 FIN   | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor at 6025e7
  | 15:02:59,300 FIN | [DeleteDeploymentCmd] deleting deployment 110
  | 15:02:59,331 FIN | [BaseJbpmTestCase] === ending testJoinASync =============================
  | 

I'm using the jobExecutor in all these examples on purpose as this is the only way I can show what is happening. Executing job one by one isn't async obviously and thus signalling the jobs doesn't reproduce this issue.


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4256651#4256651

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4256651


More information about the jbpm-users mailing list