[jboss-user] [JBoss jBPM] - Timer never stop

greenHand do-not-reply at jboss.com
Thu Jun 5 22:13:30 EDT 2008

I ran into a situation like this when I try a test process. I have a very simple process:
<?xml version="1.0" encoding="UTF-8"?>
  | <process-definition  xmlns=""  name="TryTimer">
  | 	<start-state name="start-state1">
  | 		<transition to="task-node1"></transition>
  | 	</start-state>
  | 	<task-node name="task-node1">
  | 		<task name="asignApprover">
  | 			<assignment class="com.pbsg.mst.wf.ApproverAssignmentHandler"></assignment>
  | 		</task>
  | 		<event type="node-enter">
  | 			<create-timer duedate="5 seconds" name="myTimer" repeat="10 seconds">
  | 				<action name="printsomething" class="com.pbsg.mst.wf.ApproverReminderAction"></action>
  | 			</create-timer>
  | 		</event>
  | 		<event type="node-leave">
  | 			<cancel-timer name="myTimer"></cancel-timer>
  | 		</event>
  | 		<transition to="end-state1"></transition>
  | 	</task-node>
  | 	<end-state name="end-state1"></end-state>
  | </process-definition>

I have this in onMessage in my MDB:
			NewProcessInstanceCommand newProcessInstanceCommand = new NewProcessInstanceCommand(
  | 					"TryTimer");
  | 			newProcessInstanceCommand.setKey(msg.getJMSCorrelationID());
  | 			RemoteCommandServiceHome commandServiceHome = (RemoteCommandServiceHome) ctx
  | 					.lookup("ejb/CommandServiceBean");
  | 			RemoteCommandService commandService = commandServiceHome.create();
  | 			ProcessInstance pi = (ProcessInstance) commandService
  | 					.execute(newProcessInstanceCommand);
  | 			String name = pi.getRootToken().getNode().getName();
  | 			long id = pi.getId();
  | 			JbpmContext jbpmContext = getJbpmContext();
  | 			ProcessInstance pi2 = jbpmContext.getProcessInstance(id);
  | 			pi2.signal(); //leaving start node
  | 			name = pi2.getRootToken().getNode().getName();
  | 			id = pi2.getId();
  | 			jbpmContext.close();
  | 			jbpmContext = getJbpmContext();
  | 			name = pi2.getRootToken().getNode().getName();
  | 			pi2.signal();
  | 			jbpmContext.close();

The the session time out because of a breakpoint, then an exception is thrown. I believe this caused that the process never leave the node, so the timer never gets cancelled.

Now the ActionHandler prints the debug message 10 seconds. Even I shut down the app server. When the server is restarted, it starts printing without getting new MQ message.

I am not sure how to stop the running timer. Can anyone help?

A more fundemental question is that how to end the task and leave the node programatically and hopefully the timer can be stopped? I did not specify actorId for the task. The methods in TaskMgmtSession require a instance or an id. Is there a way that I get all the task instance without requiring an id?


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

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

More information about the jboss-user mailing list