The creation of a new timer is not so obvious from the the jbpm api:

Here is the code:

protected Timer createTimer(ExecutionContext executionContext) {
  |     Timer timer = new Timer(executionContext.getToken());
  |     timer.setName(timerName);
  |     timer.setRepeat(repeat);
  |     if (dueDate!=null) {
  |       Duration duration = new Duration(dueDate);
  |       Date dueDateDate = businessCalendar.add( new Date(), duration );
  |       timer.setDueDate(dueDateDate);
  |     }
  |     timer.setAction(timerAction);
  |     timer.setTransitionName(transitionName);
  |     timer.setGraphElement(executionContext.getEventSource());
  |     timer.setTaskInstance(executionContext.getTaskInstance());
  |     
  |     // if this action was executed for a graph element
  |     if ( (getEvent()!=null)
  |          && (getEvent().getGraphElement()!=null)
  |        ) {
  |       GraphElement graphElement = getEvent().getGraphElement();
  |       try {
  |         executionContext.setTimer(timer);
  |         // fire the create timer event on the same graph element
  |         graphElement.fireEvent("timer-create", executionContext);
  |       } finally {
  |         executionContext.setTimer(null);
  |       }
  |     }
  |     
  |     return timer;
  |   }

So what I did instead is reuse the timer created by the system and change the 
dueDate of my preference. Seems worked to some extent. But I am not sure it is 
the right way to do. Under heavy volumn, TimerServiceBean can get runtime 
exception because of treecache errors. And some timers just hang in the timers 
table and been ignored. I will try to limit the pool size of the session bean 
to see if make any difference. 

Anyway, I think the flexible timers should be configurable from the 
processdefination and some interface to calculate the dueDate provided for that 
purpose. Right now, I have to create spring bean for this to happen. 

Justin

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061339
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to