<?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 webscript synchronized problem in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/webscript-synchronized-problem/m-p/261909#M215039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hello everyone:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hvae meet a problem about execute a same webscrpit twice at the same time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The second webscript executed when the first's unfinished.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The main job of the webscript is updating or creating node by a imported file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Before the creating node, script will check the same name node existed or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;only the unexisted condition that occuring the creating execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if the first webscript create a node named "AAA" and commit to the UserTransaction&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(UserTransaction transaction = serviceRegistry.getTransactionService().getUserTransaction())&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then the second webscript also need to create node "AAA",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but this time, the exeisting check of second webscript is uneffected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so the second webscript will occure a DuplicateChildNodeNameException;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;"org.alfresco.service.cmr.repository.DuplicateChildNodeNameException: Duplicate child name not allowed: AAA"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so will&amp;nbsp; webscript synchronize data before it finished the executing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so is anyone have faced the problem like this before?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help first~&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Dec 2012 10:28:25 GMT</pubDate>
    <dc:creator>redybol2013</dc:creator>
    <dc:date>2012-12-25T10:28:25Z</dc:date>
    <item>
      <title>webscript synchronized problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/webscript-synchronized-problem/m-p/261909#M215039</link>
      <description>hello everyone:I hvae meet a problem about execute a same webscrpit twice at the same time.The second webscript executed when the first's unfinished.The main job of the webscript is updating or creating node by a imported file.Before the creating node, script will check the same name node existed or</description>
      <pubDate>Tue, 25 Dec 2012 10:28:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/webscript-synchronized-problem/m-p/261909#M215039</guid>
      <dc:creator>redybol2013</dc:creator>
      <dc:date>2012-12-25T10:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: webscript synchronized problem</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/webscript-synchronized-problem/m-p/261910#M215040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As you state the problem seems to be that your second transaction does not see the new node because it was created in a parallel transaction so it tries to create it and throws a duplicaChildNodeNameException.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alfresco has a &amp;lt;a href="&lt;/SPAN&gt;&lt;A href="http://wiki.alfresco.com/wiki/Java_Foundation_API#Using_RetryingTransactionHelper" rel="nofollow noopener noreferrer"&gt;http://wiki.alfresco.com/wiki/Java_Foundation_API#Using_RetryingTransactionHelper&lt;/A&gt;&lt;SPAN&gt;" target="_blank"&amp;gt;RetryingTransactionHelper&amp;lt;/a&amp;gt; that could make your code retry in case of a failure like this. But keep those things in mind:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.- Call &amp;lt;a href="&lt;/SPAN&gt;&lt;A href="http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/repo/transaction/RetryingTransactionHelper.html#doInTransaction" rel="nofollow noopener noreferrer"&gt;http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/repo/transaction/RetryingTransactionHelper.html#doInTransaction&lt;/A&gt;&lt;SPAN&gt;(org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback, boolean, boolean)"&amp;gt;doInTransaction&amp;lt;/a&amp;gt; so that a new transaction is used, otherwise you won't see the new node in the second attempt either.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. - Only some &amp;lt;a href="&lt;/SPAN&gt;&lt;A href="http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/repository/source/java/org/alfresco/repo/transaction/RetryingTransactionHelper.java" rel="nofollow noopener noreferrer"&gt;http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/repository/source/java/org/alfresco/repo/transaction/RetryingTransactionHelper.java&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;exceptions classes&amp;lt;/a&amp;gt; cause retrying,so you might have to capture DuplicateChildNodeNameException and rethrow it as one of those exceptions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 15:32:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/webscript-synchronized-problem/m-p/261910#M215040</guid>
      <dc:creator>iblanco</dc:creator>
      <dc:date>2013-04-08T15:32:00Z</dc:date>
    </item>
  </channel>
</rss>

