cancel
Showing results for 
Search instead for 
Did you mean: 

Can 'multiInstanceLoopCharacteristics' task process parallelly?

sniperxyp
Champ in-the-making
Champ in-the-making
Hi,
When I set a task with below:
<multiInstanceLoopCharacteristics isSequential="false">
        <loopCardinality>3</loopCardinality>
      </multiInstanceLoopCharacteristics>


I found it processed serially,not parallelly as expected.
I debuged it. In org.activiti.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior it shows all the "instances" will be lanuched in a "for (int loopCounter=0; loopCounter<nrOfInstances; loopCounter++) " with the same thread.Am i right? Or there is some thing wrong when i drowing the bpmn?

Is there some suggestions for the (activiti-engine)source extension that i can get  a parallelly running?

I change the *.bpmn into *.bpmn.txt in the attachedments as only txt files is allowed…


<process id="aaaaa" name="aaaaa" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <subProcess id="subprocess1" name="Sub Process">
      <multiInstanceLoopCharacteristics isSequential="false">
        <loopCardinality>3</loopCardinality>
      </multiInstanceLoopCharacteristics>
      <scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript" activiti:autoStoreVariables="true">
        <script>println("——————");</script>
      </scriptTask>
      <startEvent id="startevent2" name="Start"></startEvent>
      <endEvent id="endevent1" name="End"></endEvent>
      <sequenceFlow id="flow1" sourceRef="scripttask1" targetRef="endevent1"></sequenceFlow>
      <sequenceFlow id="flow2" sourceRef="startevent2" targetRef="scripttask1"></sequenceFlow>
    </subProcess>
    <sequenceFlow id="flow3" sourceRef="startevent1" targetRef="subprocess1"></sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <sequenceFlow id="flow4" sourceRef="subprocess1" targetRef="endevent2"></sequenceFlow>
  </process>
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
No, Activiti will never multi-thread for this (would lead to transaction synchronization issues).