[jboss-user] [jBPM Users] - Re: Timer throwing exception intermittently

sridhar18 do-not-reply at jboss.com
Mon Nov 2 13:59:54 EST 2009


Sure. Thanks for the response. You could use the below process defnintion and EventListener class to try to reproduce this:

  | <?xml version="1.0" encoding="UTF-8"?>
  | 
  | <process name="MyWorkflow" xmlns="http://jbpm.org/4.0/jpdl">
  | 
  |    <start g="11,265,80,40">
  |       <transition to="fork"/>
  |    </start>
  | 
  |    <fork g="76,263,80,40" name="fork">
  |       <transition to="ValidateOne"/>
  |       <transition to="ValidateTwo"/>
  |    </fork>
  | 
  |    <state g="138,450,127,52" name="ValidateOne">
  |       <on event="timeout">
  |         <timer name="checkValidityForOne" duedate="3 minutes" repeat="2 minutes"/>
  |         <event-listener class="some.class.CheckValidityOneEvent">
  |           <field name="idType"><string value="ID_ONE"/></field>
  |         </event-listener>
  |       </on>
  |       <transition g="-72,-22" name="valid" to="complete"/>
  |       <transition g="-72,-22" name="invalid" to="end"/>
  |    </state>
  | 
  |    <state g="138,450,127,52" name="ValidateTwo">
  |       <on event="timeout">
  |         <timer name="checkValidityForTwo" duedate="4 minutes" repeat="5 minutes"/>
  |         <event-listener class="some.class.CheckValidityTwoEvent">
  |           <field name="idType"><string value="ID_TWO"/></field>
  |         </event-listener>
  |       </on>
  |       <transition g="-72,-22" name="valid" to="complete"/>
  |       <transition g="-72,-22" name="invalid" to="end"/>
  |    </state>
  | 
  |    <join g="706,212,48,48" multiplicity="2" name="complete">
  |       <transition to="end"/>
  |    </join>
  | 
  |    <end g="779,213,48,48" name="end"/>
  | </process>
  | 

It just has a fork, two concurrent activities (events), and a join.

My sample event listener class:

  | @SuppressWarnings("serial")
  | public class CheckValidityOneEvent implements EventListener {
  |     private final Logger log = Logger.getLogger(this.getClass());
  | 
  |     @Override
  |     public void notify(EventListenerExecution execution) throws Exception {
  |         try {
  |             // business logic, check for condition
  | 
  |             // if condition met, signal execution by id
  |                 executionService.signalExecutionById(execution.getId(), "valid");
  | 
  |             // otherwise, do nothing
  |         } catch (Exception ex) {
  |             // catch all exceptions and don't rethrow them.
  |             log.error("Exception occured: " + ex.getMessage());
  |         }
  |     }
  | }
  | 
So on each timeout, the timer will perform a check and transitions to valid only if the check is successful. Otherwise it does nothing. I won't throw any exceptions up the chain. 
I have my .bar and library jar deployed to jboss 5.1 GA. Let me know if you need anymore information.
Thanks.




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

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



More information about the jboss-user mailing list