<?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: Problem in multi-instances and subprocess. in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/problem-in-multi-instances-and-subprocess/m-p/2495#M520</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Olivier,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per Activiti documentation on exclusive jobs,&amp;nbsp;&lt;A class="link-titled" href="https://www.activiti.org/userguide/#exclusiveJobs" title="https://www.activiti.org/userguide/#exclusiveJobs" rel="nofollow noopener noreferrer"&gt;Activiti User Guide&lt;/A&gt;, all jobs that are marked 'exclusive' won't be executed concurrently. Also per documentation, all BPMN nodes including sub process, services are set to be 'exclusive' by default. This is a feature of Activiti since version 5.9 to solve issues discussed here&amp;nbsp;&lt;A class="link-titled" href="https://www.activiti.org/userguide/#_why_exclusive_jobs" title="https://www.activiti.org/userguide/#_why_exclusive_jobs" rel="nofollow noopener noreferrer"&gt;Activiti User Guide&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in short, you should not have locking problem using multi-instance sub process with async web service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried with a simple model such as below (sub process is set to be multi-instance by 4) and with the asynchronous web service call inside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11996_multiinstance1.PNG" style="width: 620px; height: 417px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My unit test completed successfully. There were 4 instances of the sub process created. The async web service jobs were all executed without any locking exception and the instance was completed.&lt;/P&gt;&lt;P&gt;Here's a snippet of the logs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------&lt;BR /&gt; T E S T S&lt;BR /&gt;-------------------------------------------------------&lt;BR /&gt;Running org.activiti.designer.test.MultiInstanceTest&lt;BR /&gt;INFO: Instance started, id 5 multiInstanceProcess:1:4&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 16&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 14&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 18&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 20&lt;/SPAN&gt;&lt;BR /&gt;INFO: Running processes: 0&lt;BR /&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 45.552 sec&lt;/P&gt;&lt;P&gt;Results :&lt;/P&gt;&lt;P&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0&lt;/P&gt;&lt;P&gt;[INFO] ------------------------------------------------------------------------&lt;BR /&gt;[INFO] BUILD SUCCESS&lt;BR /&gt;[INFO] ------------------------------------------------------------------------&lt;BR /&gt;[INFO] Total time: 47.921s&lt;BR /&gt;[INFO] Finished at: Mon Jan 09 13:48:17 ICT 2017&lt;BR /&gt;[INFO] Final Memory: 10M/166M&lt;BR /&gt;[INFO] ------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still have issue, could you share a simple unit test to demonstrate your problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you a bit,&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Thong Huynh&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Jan 2017 06:57:36 GMT</pubDate>
    <dc:creator>thuynh</dc:creator>
    <dc:date>2017-01-09T06:57:36Z</dc:date>
    <item>
      <title>Problem in multi-instances and subprocess.</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/problem-in-multi-instances-and-subprocess/m-p/2494#M519</link>
      <description>For a customer i have to create a multi instancied call-activiti that call a subprocess witch call an other subprocess and echange with an asynchronous webservice.When the webservice responds a lot of optimistic locking exceptions occure because the exclusive flag does not apply for child processes.</description>
      <pubDate>Thu, 05 Jan 2017 12:42:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/problem-in-multi-instances-and-subprocess/m-p/2494#M519</guid>
      <dc:creator>olivierlaporte</dc:creator>
      <dc:date>2017-01-05T12:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in multi-instances and subprocess.</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/problem-in-multi-instances-and-subprocess/m-p/2495#M520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Olivier,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per Activiti documentation on exclusive jobs,&amp;nbsp;&lt;A class="link-titled" href="https://www.activiti.org/userguide/#exclusiveJobs" title="https://www.activiti.org/userguide/#exclusiveJobs" rel="nofollow noopener noreferrer"&gt;Activiti User Guide&lt;/A&gt;, all jobs that are marked 'exclusive' won't be executed concurrently. Also per documentation, all BPMN nodes including sub process, services are set to be 'exclusive' by default. This is a feature of Activiti since version 5.9 to solve issues discussed here&amp;nbsp;&lt;A class="link-titled" href="https://www.activiti.org/userguide/#_why_exclusive_jobs" title="https://www.activiti.org/userguide/#_why_exclusive_jobs" rel="nofollow noopener noreferrer"&gt;Activiti User Guide&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So in short, you should not have locking problem using multi-instance sub process with async web service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried with a simple model such as below (sub process is set to be multi-instance by 4) and with the asynchronous web service call inside.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://connect.hyland.com/legacyfs/online/alfresco/11996_multiinstance1.PNG" style="width: 620px; height: 417px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My unit test completed successfully. There were 4 instances of the sub process created. The async web service jobs were all executed without any locking exception and the instance was completed.&lt;/P&gt;&lt;P&gt;Here's a snippet of the logs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------&lt;BR /&gt; T E S T S&lt;BR /&gt;-------------------------------------------------------&lt;BR /&gt;Running org.activiti.designer.test.MultiInstanceTest&lt;BR /&gt;INFO: Instance started, id 5 multiInstanceProcess:1:4&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 16&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 14&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 18&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff9900;"&gt;INFO: Initiate service id 20&lt;/SPAN&gt;&lt;BR /&gt;INFO: Running processes: 0&lt;BR /&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 45.552 sec&lt;/P&gt;&lt;P&gt;Results :&lt;/P&gt;&lt;P&gt;Tests run: 1, Failures: 0, Errors: 0, Skipped: 0&lt;/P&gt;&lt;P&gt;[INFO] ------------------------------------------------------------------------&lt;BR /&gt;[INFO] BUILD SUCCESS&lt;BR /&gt;[INFO] ------------------------------------------------------------------------&lt;BR /&gt;[INFO] Total time: 47.921s&lt;BR /&gt;[INFO] Finished at: Mon Jan 09 13:48:17 ICT 2017&lt;BR /&gt;[INFO] Final Memory: 10M/166M&lt;BR /&gt;[INFO] ------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you still have issue, could you share a simple unit test to demonstrate your problem?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you a bit,&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Thong Huynh&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2017 06:57:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/problem-in-multi-instances-and-subprocess/m-p/2495#M520</guid>
      <dc:creator>thuynh</dc:creator>
      <dc:date>2017-01-09T06:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in multi-instances and subprocess.</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/problem-in-multi-instances-and-subprocess/m-p/2496#M521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Olivier,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I opened up your project and I believe the root cause of the optimistic locking exceptions is the following setVariable() call in your callWebServie class:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;((ExecutionEntity)execution).setVariable("reservation", postForLocation);&lt;BR /&gt;&lt;BR /&gt;Considering this is a parallel multi-instance loop, it is possible that this setVariable call will trigger the optimistic locking exceptions. Try testing without the setVariable call to determine if this really is the cause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2017 17:37:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/problem-in-multi-instances-and-subprocess/m-p/2496#M521</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2017-01-09T17:37:23Z</dc:date>
    </item>
  </channel>
</rss>

