[jboss-user] [JBoss jBPM] - Cancelling dynamically created tasks

redguy666 do-not-reply at jboss.com
Wed Dec 17 04:39:48 EST 2008


Have such case:

in one task-node I create few tasks for different actors (every one of them has to accept processed document). This is done in node-enter event when entering this task-node.

I would like to cancel all pending tasks in this node when first of those actors rejects (takes "reject" transition). How to do this?

When I write handler for task-end event that iterates through pending tasks and calls "cancel" method I get exception that the token is locked...

simplified example of this proces:

  | <process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="Proces">
  | 
  | <start-state name="start">
  |   <transition to="accept" name="send"/>
  | </start-state>
  | 
  | <task-node name="accept" create-tasks="false" signal="last-wait">
  |   <event type="node-enter">
  |     <action name="create tasks" class="xxx.CreateAcceptTasks">
  |       <actorIds>actor1,actor2,actor3,actor4</actorIds>
  |     </action>
  |   </event>
  |   <event type="task-end">
  |     <action name="is positive?" class="xxx.AcceptTaskEnd">
  |     </action>
  |   </event>
  |   <task name="accept"></task>
  |   <transition to="accepted" name="accept"></transition>
  |   <transition to="rejected" name="reject"></transition>
  | </task-node>
  | 
  | ...
  | 
  | </process-definition>
  | 

xxx.CreateAcceptTasks

just creates TaskInstances of "accept" Task and assignes them to actors provided in param.

xxx.AcceptTaskEnd

???
when I tried to fetch pending tasks with executionContext.getTaskMgmtInstance().getTaskInstances()

and then call "cancel" on every pending tasks (that is not equal to current task of course) - I get "Token locked" exception...

Any help would be appreciate...

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

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



More information about the jboss-user mailing list