Hi,
I have now implemented this ForEachForkHandler and it works. However, I have now come up
with an extended scenario.
In my ForEachForkHandler I create 4 tasks. However, in specific situations I want already
to continue when the first two tasks are completed. Therefore, I have tried to implement
a kind of housekeeping handler which I call from the join to get rid of the
"unnecessary" tasks.
My process consists of
1) fork
2) 4 activities which have been generated by the ForEachForkHandler
3) join
When entering the join I call setNOutOfM with an appropriate value. Secondly I invoke the
handler listed below:
| ublic class MultiinstanceHouseKeepingHandler implements ActionHandler {
|
| @Override
| public void execute(ExecutionContext ctx) throws Exception {
| // TODO Auto-generated method stub
| Token t = ctx.getToken();
| Collection til = ctx.getTaskMgmtInstance().getTaskInstances();
| Map childTokenList = t.getParent().getChildren();
| Set ks = childTokenList.keySet();
| Iterator it = ks.iterator();
| while (it.hasNext()) {
| Token ct = (Token)childTokenList.get(it.next());
| if (ct == t)
| continue;
| Iterator itil = til.iterator();
| while (itil.hasNext()) {
| TaskInstance ti = (TaskInstance)itil.next();
| if (ti.getToken() == ct) {
| ti.cancel();
| ct.end();
| break;
| }
| }
| }
| }
| }
|
The process continues correctly with the task following the join. However, I cannot get
rid of the other unwanted tasks and they stay forever on my worklist.
What am I doing wrong here?
Thanks,
Walter
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4156348#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...