[jboss-user] [jBPM] New message: "Re: Strange Fork Behavior"

Santanu Saraswati do-not-reply at jboss.com
Wed Jan 20 16:05:50 EST 2010


User development,

A new message was posted in the thread "Strange Fork Behavior":

http://community.jboss.org/message/521212#521212

Author  : Santanu Saraswati
Profile : http://community.jboss.org/people/saraswati.santanu

Message:
--------------------------------------------------------------
This is a bug in JBPM. The class that causes the problem is ForkActivity. Here is a discussion which explains the problem
http://community.jboss.org/message/400655#400655
 
One of the solution there, which keeps a dummy node, is a hack for sure. But it works. If you do not want to modify JBPM code and want to lie with the bug till next release (hopefully), then you can do that.
 
The other one which modifies the ForkActivity source sounds more logical.
 
There can be one more way to fix this. Lets look at the problematic segment once more (the one in red):
 
 *if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
     concurrentRoot = execution;
     execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
     execution.setActivity(null);
 } else if (Exec ution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
     concurrentRoot = execution.getParent();
 }*
 
 *for (Transition transition: forkingTransitions) {
      // launch a concurrent path of execution
      String childExecutionName = transition.getName();
      ExecutionImpl concurrentExecution = concurrentRoot.createExecution(childExecutionName);
      concurrentExecution.setActivity(activity);
      concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
      concurrentExecution.take(transition);
  
      if (concurrentRoot.isEnded()) {
          break;
      }
 }*
 
Here the parent of the first level fork becomes the parent of the second level fork as well. And that is the root of the problem. So there can be two solutions possible. We talked about one of them in that older post. Lets look at both of them one by one:
 
1. This sound most logical to me. The parent of the second level fork should be the first level for. So set the first level fork as the parent of the econd level fork. For this the first line in red needs to be changed to :
 
*else if (Exec ution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {*
*    //notice that we removed getParent() here**
      concurrentRoot = execution;
  }*
 
2. One more way to solve the prblem might be to end the first level fork execution, because that has anyway nothing on earth to do. To do this we may do something like this:
 
*else if (Exec ution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
      concurrentRoot = execution.getParent();*
*    //notice this end call here*
*   * *execution.end();*
*  }*
 
Again, my vote is for the first one. But both af them seem to work.
 
Regards,
Santanu

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/521212#521212




More information about the jboss-user mailing list