async fork
popel Aug 27, 2008 10:08 AMHi,
I've got a problem to get async nodes right. I read on JIRA ther once was an issue with this but got resolved. So I wonder where my mistake is.
JBPM Version is 3.2.3
The process definition:
<?xml version="1.0" encoding="UTF-8"?> <process-definition xmlns="" name="TestThreadSkript"> <start-state name="start-state1"> <transition to="fork1"></transition> </start-state> <fork name="fork1"> <transition to="node1" name="to node1"></transition> <transition to="node2" name="to node2"></transition> <transition to="node3" name="to node3"></transition> </fork> <node name="node1" async="true"> <script name="do it1"> <expression> String nodename=executionContext.getNode().getName(); for(int i=0;i<=7;i++){ Thread.currentThread().sleep(1000); System.out.println(nodename + " is waiting (" +i+")"); } System.out.println("loop done"); executionContext.leaveNode(); </expression> </script> <transition to="join1"></transition> </node> <node name="node2" async="true"> <script name="do it2"> <expression> String nodename=executionContext.getNode().getName(); for(int i=0;i<=7;i++){ Thread.currentThread().sleep(1000); System.out.println(nodename + " is waiting (" +i+")"); } System.out.println("loop done"); executionContext.leaveNode(); </expression> </script> <transition to="join1"></transition> </node> <node name="node3" async="true"> <script name="do it3"> <expression> String nodename=executionContext.getNode().getName(); for(int i=0;i<=7;i++){ Thread.currentThread().sleep(1000); System.out.println(nodename + " is waiting (" +i+")"); } System.out.println("loop done"); executionContext.leaveNode(); </expression> </script> <transition to="join1"></transition> </node> <join name="join1" > <transition to="end-state1"></transition> </join> <end-state name="end-state1"></end-state> </process-definition>
This throws an exception
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
This happens when the second thread enters the join node and hibernate tries to update a token.
I tested this with MYSQL and transaction-isolation = REPEATABLE-READ and READ-COMMITTED but nothing helped.
Where am I wrong?
Thanks for your help