<?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 Setting a custom IdGenerator in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60454#M37353</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Activiti allows the user to configure a custom IdGenerator in ProcessEngineConfigurationImpl. This is useful for me since I want to use the adapted DbIdGenerator from &lt;/SPAN&gt;&lt;A href="http://jira.codehaus.org/browse/ACT-789" rel="nofollow noopener noreferrer"&gt;http://jira.codehaus.org/browse/ACT-789&lt;/A&gt;&lt;SPAN&gt;. As I understand it these changes have not been applied to the Trunk since Tom felt it needed more testing in a production environment, which has not happened yet.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I thought, I’ll just copy the patched code to my own DbBlockIdGenerator and configure the engine to use it instead of the default. However, this does not work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that the BlockIdGenerator needs a CommandExecutor. This executor is set on the default IdGenerator the following code in ProcessEngineConfigurationImpl:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;protected void initIdGenerator() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if (idGenerator==null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DbIdGenerator dbIdGenerator = new DbIdGenerator();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbIdGenerator.setIdBlockSize(idBlockSize);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbIdGenerator.setCommandExecutor(commandExecutorTxRequiresNew);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; idGenerator = dbIdGenerator;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;Obviously this will not work if I want to supply my own IdGenerator. Therefore I made some changes and created a patch.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- I added the interface CommandExecutorAware with the sole method setCommandExecutor. I could have simply added the method to IdGenerator, but that would not be backwards compatible (since people may already have made their own implementation of the interface). I’m sure you will feel free to change this if you feel it is more appropriate &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://connect.hyland.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- initIdGenerator in ProcessEngineConfigurationImpl now checks for this interface:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;if (idGenerator==null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DbIdGenerator dbIdGenerator = new DbIdGenerator();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbIdGenerator.setIdBlockSize(idBlockSize);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; idGenerator = dbIdGenerator;&lt;BR /&gt;}&lt;BR /&gt;if (idGenerator instanceof CommandExecutorAware) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((CommandExecutorAware) idGenerator).setCommandExecutor(commandExecutorTxRequiresNew);&lt;BR /&gt;}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;- I added the DbBlockIdGenerator (which is the DbIdGenerator with the changes from ACT-789).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- The default DbIdGenerator and the new DbBlockIdGenerator now implement CommandExecutorAware.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See &lt;/SPAN&gt;&lt;A href="http://jira.codehaus.org/browse/ACT-902" rel="nofollow noopener noreferrer"&gt;http://jira.codehaus.org/browse/ACT-902&lt;/A&gt;&lt;SPAN&gt; for the patch.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Sep 2011 09:44:04 GMT</pubDate>
    <dc:creator>marcus1</dc:creator>
    <dc:date>2011-09-15T09:44:04Z</dc:date>
    <item>
      <title>Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60454#M37353</link>
      <description>Activiti allows the user to configure a custom IdGenerator in ProcessEngineConfigurationImpl. This is useful for me since I want to use the adapted DbIdGenerator from http://jira.codehaus.org/browse/ACT-789. As I understand it these changes have not been applied to the Trunk since Tom felt it needed</description>
      <pubDate>Thu, 15 Sep 2011 09:44:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60454#M37353</guid>
      <dc:creator>marcus1</dc:creator>
      <dc:date>2011-09-15T09:44:04Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60455#M37354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Afaik, the custom id generator was added to trunk, just not enabled by default.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 13:43:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60455#M37354</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2011-09-15T13:43:15Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60456#M37355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I only see two implementations of IdGenerator in Trunk: the default DbIdGenerator and StrongUuidGenerator. StrongUuidGenerator does not need a CommandExecutor.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 21:07:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60456#M37355</guid>
      <dc:creator>marcus1</dc:creator>
      <dc:date>2011-09-15T21:07:46Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60457#M37356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The second one is the 'new' one…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Sep 2011 22:34:41 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60457#M37356</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2011-09-15T22:34:41Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60458#M37357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I realize that StrongUuidGenerator is newer than DbIdGenerator &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://connect.hyland.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We experienced the same concurrency issues as described in this thread: &lt;/SPAN&gt;&lt;A href="http://forums.activiti.org/en/viewtopic.php?f=6&amp;amp;t=1521" rel="nofollow noopener noreferrer"&gt;http://forums.activiti.org/en/viewtopic.php?f=6&amp;amp;t=1521&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The patch posted by Tom Baeyens in that thread (&lt;/SPAN&gt;&lt;A href="http://forums.activiti.org/en/viewtopic.php?f=6&amp;amp;t=1521&amp;amp;start=10#p6523" rel="nofollow noopener noreferrer"&gt;last post&lt;/A&gt;&lt;SPAN&gt;) seems to have fixed this issue for us. However, to be able to configure it (&lt;/SPAN&gt;&lt;STRONG&gt;or any other custom IdGenerator which needs a CommandExecutor for i.e. database access&lt;/STRONG&gt;&lt;SPAN&gt;), the changes I described are needed (AFAIK).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2011 07:13:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60458#M37357</guid>
      <dc:creator>marcus1</dc:creator>
      <dc:date>2011-09-16T07:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60459#M37358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;wasn't the concurrency issue caused by using a db id&amp;nbsp; generator that&amp;nbsp; needed db access? So wouldn't introducing a new/custom db id generator that requires this as wel have the same issues? Unless a separate connection is used for this… But then that is needed and not the command executor. Or do I mis something?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2011 07:45:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60459#M37358</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2011-09-16T07:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60460#M37359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As I understand it the db connection was part of the problem, but that seems to have been solved in the adapted DbIdGenerator. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The generator uses a commandExecutorTxRequiresNew, and thus a separate connection (AFAIK):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if (idGenerator instanceof CommandExecutorAware) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((CommandExecutorAware) idGenerator).setCommandExecutor(&lt;/SPAN&gt;&lt;STRONG&gt;commandExecutorTxRequiresNew&lt;/STRONG&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2011 07:56:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60460#M37359</guid>
      <dc:creator>marcus1</dc:creator>
      <dc:date>2011-09-16T07:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60461#M37360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, I meant separate connection pool… The issue was that if all connections are busy doing functional db stuff, there is no connection anymore to retrieve a new id. But I could be wrong that that is solved by the change. If so, the need for the uuid db generator&amp;nbsp; was superfluous.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2011 08:08:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60461#M37360</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2011-09-16T08:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a custom IdGenerator</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60462#M37361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hmm… I'm now wondering why I haven't simply been using the StrongUuidGenerator… It seems to work fine after some quick tests.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2011 14:34:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/setting-a-custom-idgenerator/m-p/60462#M37361</guid>
      <dc:creator>marcus1</dc:creator>
      <dc:date>2011-09-19T14:34:24Z</dc:date>
    </item>
  </channel>
</rss>

