ycyk_168 发表于 2013-1-29 23:10:49

JBPM源码解读之:Fork

      Fork节点在整个JBPM流程运转过程中配合Join使用提供使多于一个的节点如:TaskNode、State等并行运行的作用,很可惜我们不能利用Fork提供的现有机制实现需求中经常遇到的并发子流程的效果,当然虽然JBPM并不支持并发子流程的机制,并不代表我们不能变通的实现,我将在另一篇文章中详细说明我的并发子流程的实现方式。
      Fork类的注释中说:if this fork behaviour is not sufficient for your needs, consider writing your own custom TokenHandler.看来连JBPM开发小组也意识到Fork可能不能满足某些特殊的需求。注释中还说Fork节点有三种配置方式,我很奇怪为什么代码中只能找到两种:
            1、without configuration : in that case the fork will launch one new sub-token over each of the leaving tranisions of the fork node.
            2、a script : can be used to calculate a collection of transition names at runtime. if a script is configured, the script must have exactly one variable with 'write' access. that variable should be assigned a java.util.Collection in the script expression.
     Fork类继承自Node并实现了Parsable接口。Fork类相对简单,他的私有成员变量只有一个:
<div style="border-right: #cccccc 1px solid; padding-right: 5px; border-top: #cccccc 1px solid; padding-left: 4px; font-size: 13px; padding-bottom: 4px; border-left: #cccccc 1px solid; width: 98%; padding-top: 4px; border-bottom: #cccccc 1px solid; background-color: #eeeeee;">1http://www.blogjava.net/Images/OutliningIndicators/ExpandedBlockStart.gifhttp://www.blogjava.net/Images/OutliningIndicators/ContractedBlock.gif/** *//**
2http://www.blogjava.net/Images/OutliningIndicators/InBlock.gif       * a script that calculates the transitionNames at runtime.
3http://www.blogjava.net/Images/OutliningIndicators/ExpandedBlockEnd.gif       */
4http://www.blogjava.net/Images/OutliningIndicators/None.gif      Script script = null;
页: [1]
查看完整版本: JBPM源码解读之:Fork