[jboss-user] [jBPM Users] - End tasks in a Fork

matrixpooh do-not-reply at jboss.com
Thu Nov 19 08:57:53 EST 2009


My process is a fork with two task nodes and a join. 

I trigger the process to start both tasks and then end each of them. 
During the execution of end() on task 1, the task is being submitted and then immediately re-instantiated. So when the token is at the join, I still have a freshly created task 1 pending in the actor's queue.
 
Also, it seems like though 'task-end' is called on the child token, the root token proceeds with 'node-enter' on the same task.

Here's the process definition:


  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <process-definition  xmlns=""  name="parallel.two.sequential.one">
  | 	
  |         <swimlane name="...">
  | ....
  | 	</swimlane>
  | 
  | 	<start-state name="start">
  | 		<transition to="fork1"></transition>
  | 	</start-state>
  | 
  | 	<fork name="fork1">
  | 		<transition to="task-node1" name="to-task-1"></transition>
  | 		<transition to="task-node2" name="to-task-2"></transition>
  | 	</fork>
  | 
  | 	<join name="join1">
  | 		<transition to="task-node3"></transition>
  | 	</join>
  | <task-node name="task-node1" >
  | 		<task swimlane="..." name="Task 1" notify="true">
  | 			<controller class="..."/>
  | 		</task>
  | 		<transition to="join1" name="to-the-end"></transition>
  | 	</task-node>
  | 
  | 	<task-node name="task-node2">
  | 		<task swimlane="..." name="Task 2" notify="true">
  | 			<controller class="..."/>
  | 		</task>
  | 		<transition to="join1" name="to-the-end"></transition>
  | 	</task-node>
  | 	
  | 	<end-state name="end"></end-state>
  | </process-definition>


Here's the snippet of the execution:

  | 
  | ProcessInstance processInstance = new ProcessInstance(processDefinition);
  | 	
  | Token token = processInstance.getRootToken();
  | assertEquals("start", token.getNode().getName());
  | 	
  | token.signal();
  | 		
  | Map<String, Token> childTokens = token.getActiveChildren();
  | assertTrue(childTokens.size() > 0);
  | 
  | final Iterator<Token> iterator = childTokens.values().iterator();
  | Token oneBranchToken = iterator.next();
  | TaskMgmtInstance taskManagementInstance = oneBranchToken .getProcessInstance().getTaskMgmtInstance();
  | Collection<TaskInstance> taskInstances = 
  | 							taskManagementInstance.getUnfinishedTasks(oneBranchToken );
  | TaskInstance taskInstance = taskInstances.iterator().next();
  | taskInstance.end();
  | 
  | jbpmContext.save(processInstance);
  | 

Here's the debug log snippet that shows task 1 being submitted and then immediately initialized again:

08:48:11,091 DEBUG|main|: [GraphElement:fireEvent:179] event 'after-signal' on StartState(start) for Token(/)
08:48:11,091 DEBUG|main|: [GraphElement:fireEvent:179] event 'task-end' on Task(Task 1) for Token(/to-task-1)
08:48:11,091 DEBUG|main|: [Controller:submitTaskVariables:23] -------------current node::Task 1
08:48:11,091 DEBUG|main|: [GraphElement:fireEvent:179] event 'before-signal' on Fork(fork1) for Token(/)
08:48:11,091 DEBUG|main|: [GraphElement:fireEvent:179] event 'node-leave' on Fork(fork1) for Token(/)
08:48:11,091 DEBUG|main|: [GraphElement:fireEvent:179] event 'transition' on Transition(to-task-1) for Token(/)
08:48:11,091 DEBUG|main|: [GraphElement:fireEvent:179] event 'node-enter' on TaskNode(task-node1) for Token(/)
08:48:11,107 DEBUG|main|: [Controller:initializeTaskVariables:17] -------------current node::Task 1
08:48:11,107 DEBUG|main|: [GraphElement:fireEvent:179] event 'task-create' on Task(Task 1) for Token(/)
08:48:11,107 DEBUG|main|: [TaskInstance:setActorId:258] assigning task 'Task 1' to 'analyst'
08:48:11,107 DEBUG|main|: [GraphElement:fireEvent:179] event 'task-assign' on Task(Task 1) for Token(/)
08:48:11,107 DEBUG|main|: [GraphElement:executeAction:271] executing Action(Task 1)
08:48:11,107 DEBUG|main|: [Token:lock:748] token[2489] is locked by token[2489]
08:48:11,107 DEBUG|main|: [Mail:send:189] skipping mail because there are no recipients
08:48:11,122 DEBUG|main|: [Token:unlock:765] token[2489] is unlocked by token[2489]


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

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



More information about the jboss-user mailing list