AnsweredAssumed Answered

multiInstanceCharacteristics - Sequential Execution Issue

Question asked by jagathvijayan on May 3, 2011
Latest reply on May 4, 2011 by jagathvijayan
For sequential executions (isSequential="true"), only the first value from the collection gets assigned to all the executions.  For parallel executions (isSequential="false"), it works fine and each execution gets one value from the collection.

Here's the snippet:

    <serviceTask id="servicetask1" name="Serial Multi Task" activiti:class="com.activity.test.SerialMultiDelegate" activiti:assignee="${item}">
       <multiInstanceLoopCharacteristics isSequential="false" activiti:collection="${items}" activiti:elementVariable="item" />

public class SerialMultiDelegate implements JavaDelegate {

   public void execute(DelegateExecution execution) throws Exception {
      String item = (String) execution.getVariable("item");
      Thread.sleep((System.currentTimeMillis() % 5) * 1000);
      System.out.println("Item: " + item);


public class SerialMultiRunner {

   public static void main(String[] args) {
      ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
      RepositoryService repositoryService = processEngine
      RuntimeService runtimeService = processEngine.getRuntimeService();
      Collection<String> items = new ArrayList<String>();
      Map<String, Object> processVariables = new HashMap<String, Object>();
      processVariables.put("items", items);


Output (When isSequential="true")

Item: East
Item: East
Item: East
Item: East

Output (When isSequential="false")

Item: East
Item: West
Item: North
Item: South

Has anyone encountered a similar issue? Is this a bug or expected behavior?