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

kukeltje do-not-reply at jboss.com
Thu Jun 21 09:29:04 EDT 2007


Alex,

I did some tests and I have varying results. Varying in the sense that the same test run multiple times sometimes pass and sometimes don't.

This is what I used for the jobexecuterconfig

  <bean name="jbpm.job.executor" class="org.jbpm.job.executor.JobExecutor">
  |     <field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
  |     <field name="name"><string value="JbpmJobExector" /></field>
  |     <field name="nbrOfThreads"><int value="2" /></field>
  |     <field name="idleInterval"><int value="5000" /></field>
  |     <field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->
  |     <field name="historyMaxSize"><int value="20" /></field>
  |     <field name="maxLockTime"><int value="600000" /></field> <!-- 10 minutes -->
  |     <field name="lockMonitorInterval"><int value="60000" /></field> <!-- 1 minute -->
  |     <field name="lockBufferTime"><int value="5000" /></field> <!-- 5 seconds -->
  |   </bean>

My process:
 
  | <process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="simpletest" >
  | 	<start-state name="start-state1">
  | 		<description>start of the process</description>
  | 		<event type="node-enter">
  | 			<script name="script_start">
  | 				System.out.println("START");
  | 				executionContext.leaveNode();
  | 			</script>
  | 		</event>
  | 		<transition name="start-to-check" to="fileCheck" />
  | 	</start-state>
  | 
  | 	<node name="fileCheck">
  | 		<script name="script_filecheck">
  | 			System.out.println("FILE-CHECK");
  | 			executionContext.leaveNode();
  | 		</script>
  | 		<transition name="check-to-fork" to="fork1"></transition>
  | 	</node>
  | 
  | 	<fork name="fork1">
  | 		<transition name="toNode1" to="node1"></transition>
  | 		<transition name="toNode2" to="node2"></transition>
  | 	</fork>
  | 
  | 	<node name="node1" async="true">
  | 		<script name="script_node1">
  | 			System.out.println("NODE1");
  | 			executionContext.leaveNode();
  | 		</script>
  | 		<transition name="node1toJoin1" to="join1"></transition>
  | 	</node>
  | 
  | 	<node name="node2" async="true">
  | 		<script name="script_node2">
  | 			System.out.println("NODE2");
  | 			executionContext.leaveNode();
  | 		</script>
  | 		<transition name="node2toJoin1" to="join1"></transition>
  | 	</node>
  | 
  | 	<join name="join1">
  | 		<transition name="join1ToNode3" to="node3"></transition>
  | 	</join>
  | 	
  | 	<node name="node3">
  | 		<script name="script_node3">
  | 			System.out.println("NODE3");
  | 		</script>
  | 		<transition name="node3ToEnd" to="end-state-success"></transition>
  | 	</node>
  | 
  | 	<end-state name="end-state-success">
  | 		<description>process finished normally</description>
  | 		<event type="node-enter">
  | 			<script name="script_endSuccess">
  | 				System.out.println("END-SUCCESS");
  | 			</script>
  | 		</event>
  | 	</end-state>
  | </process-definition>

unittest

  | 
  | public class AlexTest extends AbstractDbTestCase {
  | 
  |   public void testAlex(){
  | 	  
  | 	 try {
  | 	    ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("alex.xml");
  | 	    
  | 	    processDefinition = saveAndReload(processDefinition);
  | 	    ProcessInstance processInstance = new ProcessInstance(processDefinition);
  | 	    processInstance.signal();
  | 	    jbpmContext.save(processInstance);
  | 	    processJobs(20000);
  | 	    processDefinition = graphSession.loadProcessDefinition(processDefinition.getId());
  | 	    processInstance = graphSession.loadProcessInstance(processInstance.getId());
  | 	    assertEquals(processDefinition.getNode("node3"), processInstance.getRootToken().getNode());
  | 	    } catch (Exception e) {
  | 	        e.printStackTrace();
  | 	        assertFalse(true);
  | 	      }
  | 	  } 
  |   
  | }

Try copying this test method multiple times in the testcase with different names. Often the first one failes, but the others always succeed then.

changing async=true in async=exclusive makes the test always work.

For me this is the end of the research... 
- async is exclusive makes the problem go away (tom suggested this in the other thread, did you try it?)
- since the problem is kind of strange, I'm still of the opinion that jms improves things.
- polling like you want to do it is not a 'good practice', using an ESB is.



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

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



More information about the jboss-user mailing list