[jboss-user] [JBoss jBPM] - Re: async fork

rbuss do-not-reply at jboss.com
Sat Sep 20 19:08:12 EDT 2008

I have the same problem with a similar small fork- join- process. 

<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="SimpleFork">
  | 	<start-state name="start-state1">
  | 		<transition to="fork1"></transition>
  | 	</start-state>
  | 	<fork name="fork1">
  | 		<transition to="node1"></transition>
  | 		<transition to="node2" name="to node2"></transition>
  | 	</fork>
  | 	<node name="node1" async="true">
  | 		 <action name="action" class="com.sample.action.ContinueActionHandler">
  |             <message>In Node 1</message>
  |          </action>
  | 		<transition to="join1" name="to join1"></transition>
  | 	</node>
  | 	<node name="node2" async="true">
  | 		 <action name="action" class="com.sample.action.ContinueActionHandler">
  |             <message>In Node 2</message>
  |          </action>
  | 		<transition to="join1" name="to join1"></transition>
  | 	</node>
  | 	<join name="join1">
  | 		<transition to="node3"></transition>
  | 	</join>
  | 	<node name="node3">
  | 		 <action name="action" class="com.sample.action.ContinueActionHandler" async="false">
  |             <message>In Node 3</message>
  |          </action>
  | 		<transition to="end-state1" name="to end-state1"></transition>
  | 	</node>
  | 	<end-state name="end-state1"></end-state>
  | </process-definition>

StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.context.exe.ContextInstance#275]

My example uses a simple actionhandler instead of the scripting you use, but that should not matter. 

public class ContinueActionHandler implements ActionHandler {
  | 	private static final long serialVersionUID = 1L;
  | 	String message;
  | 	public void execute(ExecutionContext context) throws Exception {
  | 		context.getContextInstance().setVariable("message", message);
  | 		System.out.println("In Message: "+ message);
  | 		if("In Node 1".equals(message)) {
  | 			this.spendSomeTime();
  | 			System.out.println("After spent some time: "+ message);
  | 		}
  | 		System.out.println("Before leaving: "+ message);
  | 		context.leaveNode();
  | 	}
  | 	private void spendSomeTime() {
  | 		for(int i=0; i< 2000000;i++) {
  | 			String dd = "do something";
  | 		}
  | 	}
  | }
In my opinion this problem is an essential one, because using async- nodes in fork- join should be AFAIK the way to execute actions asynchronously.

I started using jBPM a year ago with version 3.2.1 (AS 4.2.1) implementing a non interactive  workflow executing several activities. I had problems with parallel executions and implemented a custom fork- join mechanism as a workaround. (I assumed I did not understand jBPM correctly especially because the suite was delivered with AS 4.0). Unfortunately my solution is neither compatible with 3.2.2 nor with 3.2.3, because the behaviour of the standard join- node was modified.
Now our workflow implementation has to be extended and I want to refactor the code using only standards. 

I started tests with a small process as you did and installed it in a new clean environment:  I use a customized enterprise- ear delivered with jbpm-jpdl-3.2.3, a fresh installed jboss 4.2.3 GA server and a new schema on a Oracle xe database. (The same error I got using the hsql- database configured in the Jboss- server of the jpdl- suite) 

Unfortunately I did not find any jpdl- example describing the scenario. The chapters in manuals about 'Asynchronous continuations'  are a little bit vague. Similar scenarios use a node and a task inside the different execution pathes.
I wonder if nobody uses parallel executions in background or if there is another standard way to solve this with jBPM.
Has anybody experiences with those items or any idea ? If you want to know more about my environment, I would like to send my configuration files.

Thanks in advance 


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

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

More information about the jboss-user mailing list