Ok, here's the situation.

I have a process that relies heavily on timers.  In fact, the business process 
looks something like: do something, do something else after 10 days, do 
something else after 10 more days, etc.  Some of the somethings are automated 
(node), and some are not (tasknode).

My specific problem is that I have a node that 1) is entered by a timer, 2) 
leaves on its own, and 3) enters a node with a timer.

Process snippet describing 1 and 3:

  |     <state name="wait1">
  |             <timer duedate="10 seconds" transition="continue" />
  |             <transition name="continue" to="mynode" />
  |     </state>
  |     <node name="mynode">
  |             <action class="foo.MyActionHandler" />
  |             <transition to="wait2" />
  |     </node>
  |     <state name="wait2">
  |             <timer duedate="20 seconds" transition="continue" />
  |             <transition name="continue" to="anotherstate" />
  |     </state>
  | 

Part 2:

  |     public void execute(ExecutionContext ctx) throws Exception {
  |             log.debug("Executing mynode");
  |             ctx.leaveNode();
  |     }
  | 

Executing it as such creates wait2's timer, but does not save it (as referenced 
in other threads 
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=69040).  If I take the 
advice given in that thread and save it explicitly with anything that comes 
from JbpmSession.getCurrentJbpmSession() then I get a StaleStateException from 
wait1's timer.

For instance, if I do:

  |     public void execute(ExecutionContext ctx) throws Exception {
  |             log.debug("Executing mynode");
  |             ctx.leaveNode();
  |             
JbpmUtil.saveProcessInstanceFamily(JbpmSession.getCurrentJbpmSession().getGraphSession(),ctx.getProcessInstance());
  |     }
  | 

with JbpmUtil.saveProcessInstanceFamily():

  |     public static void saveProcessInstanceFamily(GraphSession graphSession, 
ProcessInstance processInstance) {
  |         // save family:
  |             Token token = processInstance.getRootToken();
  |             log.debug("saving process instance #" + 
processInstance.getId());
  |         graphSession.saveProcessInstance(processInstance);
  |         if (token.hasParent()) {
  |             ProcessInstance pi = token.getParent().getProcessInstance();
  |             log.debug("saving process instance #" + pi.getId());
  |             graphSession.saveProcessInstance(pi);
  |         }
  |         ProcessInstance sub = token.getSubProcessInstance();
  |         if (sub != null) {
  |             log.debug("saving process instance #" + sub.getId());
  |             graphSession.saveProcessInstance(sub);
  |         }
  |     }
  | 

then I get:

  | 2006-02-10 14:48:34,253 DEBUG [foo.MyActionHandler] Executing mynode
  | 2006-02-10 14:48:34,269 DEBUG [org.jbpm.graph.def.GraphElement] event 
'node-leave' on 'Node(mynode)' for 'Token(/)'
  | 2006-02-10 14:48:34,269 DEBUG [org.jbpm.graph.def.GraphElement] event 
'transition' on 'Transition(1c71a93)' for 'Token(/)'
  | 2006-02-10 14:48:34,269 DEBUG [org.jbpm.graph.def.GraphElement] event 
'node-enter' on 'State(wait2)' for 'Token(/)'
  | 2006-02-10 14:48:34,284 DEBUG [org.jbpm.graph.def.GraphElement] executing 
action 'CreateTimerAction(12d12e0)'
  | 2006-02-10 14:48:34,331 DEBUG [org.jbpm.db.SchedulerSession] saving timer 
timer(wait2,14:48:54,284)
  | 2006-02-10 14:48:34,363 DEBUG [org.jbpm.graph.def.GraphElement] event 
'after-signal' on 'State(wait1)' for 'Token(/)'
  | 2006-02-10 14:48:34,363 DEBUG 
[com.gallium.jas.services.workflow.impl.SchedulerBean] deleting timer 
'timer(wait1,14:48:34,000)'
  | 2006-02-10 14:48:34,394 ERROR [org.hibernate.jdbc.AbstractBatcher] 
Exception executing batch: 
  | org.hibernate.StaleStateException: Batch update returned unexpected row 
count from update: 0 actual row count: 0 expected: 1
  | 

Can anyone offer any advice?

Ian

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

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


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to