AnsweredAssumed Answered

loopCardinality in multi instance subprocess unchecked

Question asked by page80 on Dec 12, 2013
Latest reply on Dec 13, 2013 by frederikheremans1
I have a multi-instance, non-sequential, subpprocess that has an activiti:collection with (currently) two elements in it.

However, when setting multiInstanceLoopCharacteristics, I set the loopCardinality value to 5 (doing what have gleaned to mean a maximum of 5 instances/threads can run concurrently) and receive an exception when the two iterations conclude:


ERROR org.activiti.engine.impl.interceptor.CommandContext:close:140 - Error while closing command context
java.util.NoSuchElementException
        at java.util.AbstractList$Itr.next(AbstractList.java:350)
        at org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.executeOriginalBehavior(MultiInstanceActivityBehavior.java:162)
        at org.activiti.engine.impl.bpmn.behavior.ParallelMultiInstanceBehavior.createInstances(ParallelMultiInstanceBehavior.java:82)
        at org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior.execute(MultiInstanceActivityBehavior.java:89)
        at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:45)


I tried adding a  <completionCondition>${nrOfCompletedInstances/nrOfInstances == 1 }</completionCondition> to make it break out forcefully even through the loop would have completed anyway, to no avail.

Only once I changed the loopCardinality to be <= the number of iterations being performed did it not error at the end of the process.  Either there is a misnomer about what loopCardinality is in relation to "instances" described in the user guide, or there is an issue with how the number of threads are being allocated.  I would feel that if it truly is a "maximum number of concurrent processes" then I should be able to define a number greater than the size of the iterator.  A maximum should not be constraining as a minimum.

Please let me know if I am interpreting these properties correctly and if this is a bug/valid complaint.

Thanks.

Outcomes