<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0 in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241714#M194844</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Hi Gavin,&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Your process definition xml seems fine. For your information, here are the Activiti user guides on Multi-Instance (&lt;A data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=http://www.activiti.org/userguide/%23bpmnMultiInstance&amp;amp;source=gmail&amp;amp;ust=1482253390681000&amp;amp;usg=AFQjCNFTqu6emCbz4i2pYtG3hxMbO8kv-w" href="http://www.activiti.org/userguide/#bpmnMultiInstance" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.activiti.org/userguide/#bpmnMultiInstance&lt;/A&gt;)&amp;nbsp;and Async Executor (&lt;A data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=http://www.activiti.org/userguide/%23jobExecutorConfiguration&amp;amp;source=gmail&amp;amp;ust=1482253390681000&amp;amp;usg=AFQjCNEmkrnS5FasmPkJi6DQd1FFsnZ31A" href="http://www.activiti.org/userguide/#jobExecutorConfiguration" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.activiti.org/userguide/#jobExecutorConfiguration&lt;/A&gt;).&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;So I believe the following settings should be enough to get you going with Activiti Multi-Instance and Async. It worked for me.&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;UL&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Enable Multi-Instance for the subprocess by defining multi-instance sequential to false and the carnality.&lt;/LI&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Enable SyncExecutor in activiti-cfg.xml (see my attached cfg,xml)&lt;/LI&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;For the service tasks to be executed asynchronously, check 'Asynchronous' (see my attached process definition xml)&lt;/LI&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Leave the 'Exclusive' checkbox default (checked) (see my attached process definition xml and documentation why you should leave it default, &lt;A data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=http://www.activiti.org/userguide/%23exclusiveJobs&amp;amp;source=gmail&amp;amp;ust=1482253390681000&amp;amp;usg=AFQjCNEdJt32-XTAHnI_lw8T5Aj6xmbLrw" href="http://www.activiti.org/userguide/#exclusiveJobs" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.activiti.org/userguide/#exclusiveJobs&lt;/A&gt;).&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Testing this in a unit test can be troublesome as you are testing async jobs which can complete or not complete by the time the Junit test completes.&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Here is a snippet of my unit test log showing that the service tasks were executed asynchronously in the multi-instance loop.&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;&lt;IMG alt="Multi-Instance" class="image-1 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11614_multiinstance.png" style="width: 620px; height: 449px;" /&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;&lt;DIV&gt;-------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;T E S T S&lt;/DIV&gt;&lt;DIV&gt;-------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;Running org.activiti.designer.test.MultiInstanceTest&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:34 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions&lt;/DIV&gt;&lt;DIV&gt;INFO: Loading XML bean definitions from class path resource [activiti.cfg.xml]&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:36 PM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource&lt;/DIV&gt;&lt;DIV&gt;INFO: performing create on engine with resource org/activiti/db/create/activiti.h2.create.engine.sql&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource&lt;/DIV&gt;&lt;DIV&gt;INFO: performing create on history with resource org/activiti/db/create/activiti.h2.create.history.sql&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource&lt;/DIV&gt;&lt;DIV&gt;INFO: performing create on identity with resource org/activiti/db/create/activiti.h2.create.identity.sql&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.ProcessEngineImpl &amp;lt;init&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;INFO: ProcessEngine default created&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor start&lt;/DIV&gt;&lt;DIV&gt;INFO: Starting up the default async job executor [org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor].&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor startExecutingAsyncJobs&lt;/DIV&gt;&lt;DIV&gt;INFO: Creating thread pool queue of size 100&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor startExecutingAsyncJobs&lt;/DIV&gt;&lt;DIV&gt;INFO: Creating executor service with corePoolSize 2, maxPoolSize 10 and keepAliveTime 5000&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.AcquireTimerJobsRunnable run&lt;/DIV&gt;&lt;DIV&gt;INFO: {} starting to acquire async jobs due&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.AcquireAsyncJobsDueRunnable run&lt;/DIV&gt;&lt;DIV&gt;INFO: {} starting to acquire async jobs due&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy&lt;/DIV&gt;&lt;DIV&gt;INFO: Processing resource multiInstanceProcess.bpmn20.xml&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Instance started, id 5 multiInstanceProcess:1:4&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Execute create service task for execution id 14&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Execute create service task for execution id 18&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Running processes: 0&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Execute create service task for execution id 20&lt;/DIV&gt;&lt;DIV&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.707 sec&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Results :&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;[INFO] ------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;[INFO] BUILD SUCCESS&lt;/DIV&gt;&lt;DIV&gt;[INFO] ------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;[INFO] Total time: 7.308s&lt;/DIV&gt;&lt;DIV&gt;[INFO] Finished at: Mon Dec 19 12:18:38 ICT 2016&lt;/DIV&gt;&lt;DIV&gt;[INFO] Final Memory: 10M/167M&lt;/DIV&gt;&lt;DIV&gt;[INFO] ------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Hope this helps,&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Thong Huynh&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Dec 2016 17:10:16 GMT</pubDate>
    <dc:creator>thuynh</dc:creator>
    <dc:date>2016-12-19T17:10:16Z</dc:date>
    <item>
      <title>using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241708#M194838</link>
      <description>Hi, In my workflow,  1. there is a Multi-instance sub-process  2. the task on Subprocess are service task 3. all "service task" set activiti:async="true" activiti:exclusive="false"the image as attachementthe config as follow:&amp;lt;bean id="asyncExecutor"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;class="org.activiti.engine.impl.asyncexecu</description>
      <pubDate>Sat, 22 Oct 2016 10:06:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241708#M194838</guid>
      <dc:creator>gavin_huang</dc:creator>
      <dc:date>2016-10-22T10:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241709#M194839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&amp;lt;bean id="asyncExecutor" class="org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="corePoolSize" value="10" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="maxPoolSize" value="50" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="keepAliveTime" value="3000000" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="queueSize" value="200" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="maxTimerJobsPerAcquisition" value="2" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="maxAsyncJobsDuePerAcquisition" value="2" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="defaultAsyncJobAcquireWaitTimeInMillis"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; value="6000000" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="defaultTimerJobAcquireWaitTimeInMillis"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; value="6000000" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="timerLockTimeInMillis" value="1800000" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;lt;property name="asyncJobLockTimeInMillis" value="1800000" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/bean&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Oct 2016 10:11:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241709#M194839</guid>
      <dc:creator>gavin_huang</dc:creator>
      <dc:date>2016-10-22T10:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241710#M194840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like you are spinning off multiple parallel sub-processes and from those sub-processes you are trying to update a common variable nrOfActiveInstances. Hence this optimistic locking exception to prevent concurrent updates on a variable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Oct 2016 05:18:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241710#M194840</guid>
      <dc:creator>cjose</dc:creator>
      <dc:date>2016-10-28T05:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241711#M194841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I am spinning off multiple parallel sub-processes and know this optimistic locking exception to prevent concurrent updates on a variable. But how to solve this exception when using multiple parallel sub-processes?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My code do not try to update this common variable nrOfActiveInstances, is the multiple parallel sub-processes. So I do not know how to use multiple parallel sub-processes without optimistic locking exception. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Nov 2016 14:13:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241711#M194841</guid>
      <dc:creator>gavin_huang</dc:creator>
      <dc:date>2016-11-01T14:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241712#M194842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Gavin!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt;all "service task" set activiti:async="true" activiti:exclusive="false"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can start instances in different executions if you set async=true, exclusive=false and sequential=false in multi-instance settings. Why do you want to add more async points in subprocesses?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Nov 2016 10:32:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241712#M194842</guid>
      <dc:creator>warper</dc:creator>
      <dc:date>2016-11-02T10:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241713#M194843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Since your subprocesses contains just a two service tasks, the chances of these subprocesses ending at the same time is more and hence the variable update happening at the same time. Since I'm not across your complete use-case, it's very difficult to give a solution with the current available information. Since all your tasks inside the subprocess are set to async, setting&amp;nbsp; maxAsyncJobsDuePerAcquisition=1 in your config might help complete the subprocess, one at a time. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ciju.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 Nov 2016 06:13:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241713#M194843</guid>
      <dc:creator>cjose</dc:creator>
      <dc:date>2016-11-06T06:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: using asyncExecutor but ActivitiOptimisticLockingException on activiti 5.21.0</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241714#M194844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Hi Gavin,&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Your process definition xml seems fine. For your information, here are the Activiti user guides on Multi-Instance (&lt;A data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=http://www.activiti.org/userguide/%23bpmnMultiInstance&amp;amp;source=gmail&amp;amp;ust=1482253390681000&amp;amp;usg=AFQjCNFTqu6emCbz4i2pYtG3hxMbO8kv-w" href="http://www.activiti.org/userguide/#bpmnMultiInstance" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.activiti.org/userguide/#bpmnMultiInstance&lt;/A&gt;)&amp;nbsp;and Async Executor (&lt;A data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=http://www.activiti.org/userguide/%23jobExecutorConfiguration&amp;amp;source=gmail&amp;amp;ust=1482253390681000&amp;amp;usg=AFQjCNEmkrnS5FasmPkJi6DQd1FFsnZ31A" href="http://www.activiti.org/userguide/#jobExecutorConfiguration" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.activiti.org/userguide/#jobExecutorConfiguration&lt;/A&gt;).&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;So I believe the following settings should be enough to get you going with Activiti Multi-Instance and Async. It worked for me.&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;UL&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Enable Multi-Instance for the subprocess by defining multi-instance sequential to false and the carnality.&lt;/LI&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Enable SyncExecutor in activiti-cfg.xml (see my attached cfg,xml)&lt;/LI&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;For the service tasks to be executed asynchronously, check 'Asynchronous' (see my attached process definition xml)&lt;/LI&gt;&lt;LI style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Leave the 'Exclusive' checkbox default (checked) (see my attached process definition xml and documentation why you should leave it default, &lt;A data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=http://www.activiti.org/userguide/%23exclusiveJobs&amp;amp;source=gmail&amp;amp;ust=1482253390681000&amp;amp;usg=AFQjCNEdJt32-XTAHnI_lw8T5Aj6xmbLrw" href="http://www.activiti.org/userguide/#exclusiveJobs" style="color: #1155cc;" target="_blank" rel="nofollow noopener noreferrer"&gt;http://www.activiti.org/userguide/#exclusiveJobs&lt;/A&gt;).&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Testing this in a unit test can be troublesome as you are testing async jobs which can complete or not complete by the time the Junit test completes.&amp;nbsp;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;Here is a snippet of my unit test log showing that the service tasks were executed asynchronously in the multi-instance loop.&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;&lt;IMG alt="Multi-Instance" class="image-1 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11614_multiinstance.png" style="width: 620px; height: 449px;" /&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt; &lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: 12.8px;"&gt;&lt;DIV&gt;-------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;T E S T S&lt;/DIV&gt;&lt;DIV&gt;-------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;Running org.activiti.designer.test.MultiInstanceTest&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:34 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions&lt;/DIV&gt;&lt;DIV&gt;INFO: Loading XML bean definitions from class path resource [activiti.cfg.xml]&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:36 PM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource&lt;/DIV&gt;&lt;DIV&gt;INFO: performing create on engine with resource org/activiti/db/create/activiti.h2.create.engine.sql&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource&lt;/DIV&gt;&lt;DIV&gt;INFO: performing create on history with resource org/activiti/db/create/activiti.h2.create.history.sql&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource&lt;/DIV&gt;&lt;DIV&gt;INFO: performing create on identity with resource org/activiti/db/create/activiti.h2.create.identity.sql&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.ProcessEngineImpl &amp;lt;init&amp;gt;&lt;/DIV&gt;&lt;DIV&gt;INFO: ProcessEngine default created&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor start&lt;/DIV&gt;&lt;DIV&gt;INFO: Starting up the default async job executor [org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor].&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor startExecutingAsyncJobs&lt;/DIV&gt;&lt;DIV&gt;INFO: Creating thread pool queue of size 100&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor startExecutingAsyncJobs&lt;/DIV&gt;&lt;DIV&gt;INFO: Creating executor service with corePoolSize 2, maxPoolSize 10 and keepAliveTime 5000&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.AcquireTimerJobsRunnable run&lt;/DIV&gt;&lt;DIV&gt;INFO: {} starting to acquire async jobs due&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.asyncexecutor.AcquireAsyncJobsDueRunnable run&lt;/DIV&gt;&lt;DIV&gt;INFO: {} starting to acquire async jobs due&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:37 PM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy&lt;/DIV&gt;&lt;DIV&gt;INFO: Processing resource multiInstanceProcess.bpmn20.xml&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Instance started, id 5 multiInstanceProcess:1:4&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Execute create service task for execution id 14&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Execute create service task for execution id 18&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Running processes: 0&lt;/DIV&gt;&lt;DIV&gt;Dec 19, 2016 12:18:38 PM java.util.logging.LogManager$RootLogger log&lt;/DIV&gt;&lt;DIV&gt;INFO: Execute create service task for execution id 20&lt;/DIV&gt;&lt;DIV&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.707 sec&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Results :&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;[INFO] ------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;[INFO] BUILD SUCCESS&lt;/DIV&gt;&lt;DIV&gt;[INFO] ------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt;[INFO] Total time: 7.308s&lt;/DIV&gt;&lt;DIV&gt;[INFO] Finished at: Mon Dec 19 12:18:38 ICT 2016&lt;/DIV&gt;&lt;DIV&gt;[INFO] Final Memory: 10M/167M&lt;/DIV&gt;&lt;DIV&gt;[INFO] ------------------------------------------------------------------------&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Hope this helps,&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Thong Huynh&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2016 17:10:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/using-asyncexecutor-but-activitioptimisticlockingexception-on/m-p/241714#M194844</guid>
      <dc:creator>thuynh</dc:creator>
      <dc:date>2016-12-19T17:10:16Z</dc:date>
    </item>
  </channel>
</rss>

