[jboss-user] [jBPM Users] - Re: How to trigger Sub-process from custom state recursively

ekobir do-not-reply at jboss.com
Thu Sep 3 07:03:41 EDT 2009


Hi Ronald

Thanks for advice... I re-implemented ForEachFork and ForEachJoin for jbpm4 by using the code in ForkActivity and JoinActivity. Instead of using sub-process I used "group". 
I tried to execute "groups" concurrently in the fork by labeling them with "continue=async". 
But it created a lot of database level problems.
Then, I decided to test this with original JBPM functionality but again I got exceptions.

My question is --> Is there a way to execute "groups" async with Fork-Join or Do you suggest something else?


Please check following information.



  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <process name="testForkJoin" xmlns="http://jbpm.org/4.0/jpdl">
  | 	
  |     <start name="start1" g="255,53,48,48">
  |         <transition name="to state1" to="state1" g="-63,-22" />
  |     </start>
  | 	
  |     <custom g="198,134,157,52" name="state1" class="com.actions.RandomActivity">
  |         <transition to="fork1" g="-52,-22" />
  |     </custom>
  | 	
  |     <fork name="fork1" g="252,291,48,48">
  |         <transition name="to state2" to="state2" g="-63,-22" />
  |         <transition name="to state3" to="state3" g="-63,-22" />
  |     </fork>
  | 
  |     <group name="state2">
  |         <start>
  |             <transition to="state4" />
  |         </start>
  | 
  |         <custom g="198,134,157,52" name="state4" class="com.actions.RandomActivity" continue="async">
  |             <transition to="groupDone1" g="-52,-22" />
  |         </custom>
  |         
  |         <end name="groupDone1" />
  |         <transition to="join1" />
  |     </group>
  | 
  |     <group name="state3" continue="async">
  |         <start>
  |             <transition to="state5" />
  |         </start>
  | 
  |         <custom g="198,134,157,52" name="state5" class="com.actions.RandomActivity" continue="async">
  |             <transition to="groupDone2" g="-52,-22" />
  |         </custom>
  | 
  |         <end name="groupDone2" />
  |         <transition to="join1" />
  |     </group>
  | 
  | 
  |     <join name="join1" g="256,461,48,48">
  |         <transition name="to end1" to="end1" g="-54,-22" />
  |     </join>
  |     <end name="end1" g="263,568,48,48" />
  | </process>
  | 

and Simple RandomActivity

  | public void execute(ActivityExecution ae) throws Exception {
  | 		System.out.println("in random activity");
  |         for(int i=0; i < 10; i++){
  |             Thread.sleep(10);
  |             System.out.println(Thread.currentThread().getName()+":"+i);
  |         }
  | }
  | 

anonymous wrote : 
  | Here is the exception
  | 
  | SEVERE: Could not synchronize database state with session
  | org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.pvm.internal.model.ExecutionImpl#3]
  |         at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
  |         at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
  |         at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
  |         at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
  |         at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
  |         at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
  |         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
  |         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
  |         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
  |         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
  |         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
  |         at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:54)
  |         at org.jbpm.pvm.internal.tx.StandardTransaction.commit(StandardTransaction.java:106)
  |         at org.jbpm.pvm.internal.tx.StandardTransaction.complete(StandardTransaction.java:65)
  |         at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:61)
  |         at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
  |         at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
  |         at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:70)
  |         at com.playphone.alexander.afp.workFlowProcessor.TestWorkFlow.testForkJoinGroup(TestWorkFlow.java:63)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:597)
  |         at junit.framework.TestCase.runTest(TestCase.java:154)
  |         at junit.framework.TestCase.runBare(TestCase.java:127)
  |         at junit.framework.TestResult$1.protect(TestResult.java:106)
  |         at junit.framework.TestResult.runProtected(TestResult.java:124)
  |         at junit.framework.TestResult.run(TestResult.java:109)
  |         at junit.framework.TestCase.run(TestCase.java:118)
  |         at junit.framework.TestSuite.runTest(TestSuite.java:208)
  |         at junit.framework.TestSuite.run(TestSuite.java:203)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:597)
  |         at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
  |         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
  |         at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
  |         at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  |         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  |         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  |         at java.lang.reflect.Method.invoke(Method.java:597)
  |         at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
  |         at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
  | 
  | 

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

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



More information about the jboss-user mailing list