<?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: Accessing Business-Data via JPA before and after Timer in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57546#M35012</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The thread-pool used by activiti is afaik not pluggable. However, the jobexecutor uses a ThreadPoolExecutor. You can potentially subclass the JobExecutor and add it to your ProcessEngineCOnfiguration(Impl).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Oct 2011 08:13:02 GMT</pubDate>
    <dc:creator>frederikherema1</dc:creator>
    <dc:date>2011-10-10T08:13:02Z</dc:date>
    <item>
      <title>Accessing Business-Data via JPA before and after Timer</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57543#M35009</link>
      <description>Hello,I've setup a very simple example of a process model that involves two Service-Tasks and a single Timer Catching Event. The model is as follows:[attachment=0]TestCaseA02.png[/attachment]Our customer's development rules require to separate the persistence database from the business database. Bot</description>
      <pubDate>Mon, 10 Oct 2011 07:26:29 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57543#M35009</guid>
      <dc:creator>bardioc</dc:creator>
      <dc:date>2011-10-10T07:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Business-Data via JPA before and after Timer</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57544#M35010</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The jobexecutor responsible for executing the timers uses a different thread than the calling thread. However, it uses the same way of starting a transaction than normal execution of the process would do. The exception states:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Can't you locate your service in a different way?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 07:56:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57544#M35010</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2011-10-10T07:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Business-Data via JPA before and after Timer</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57545#M35011</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The jobexecutor responsible for executing the timers uses a different thread than the calling thread. However, it uses the same way of starting a transaction than normal execution of the process would do. The exception states:&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Can't you locate your service in a different way?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello, thanks for the fast response. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm not aware of any way doing this. WebSphere in special denies to do JNDI lookups in the "java:" context (where necessary things like java:comp/TransactionSynchronizationRegistry) are located from threads created outside of the J2EE applciation context. I would not even be able to lookup any datasource (e.g. java:comp/env/mydatasource) from threads outside the JEE context &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://connect.hyland.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a way to modify the jobexecutor to utilize "allowed" constructs to create new threads, such as using the commonJ Workmanager approach provided by WebSphere? I've not digged into Activiti enough to see if there is a pluggable API to change the JobExecutor's way of handling threads till now &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://connect.hyland.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;. I'm willing to help in here. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've actually played with the activiti-cdi version, but run into the same problem. After the jobexector ran, no bean context is available which is a dead end for us too &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://connect.hyland.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Heiko&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 08:05:25 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57545#M35011</guid>
      <dc:creator>bardioc</dc:creator>
      <dc:date>2011-10-10T08:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Business-Data via JPA before and after Timer</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57546#M35012</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The thread-pool used by activiti is afaik not pluggable. However, the jobexecutor uses a ThreadPoolExecutor. You can potentially subclass the JobExecutor and add it to your ProcessEngineCOnfiguration(Impl).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 08:13:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57546#M35012</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2011-10-10T08:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing Business-Data via JPA before and after Timer</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57547#M35013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The thread-pool used by activiti is afaik not pluggable. However, the jobexecutor uses a ThreadPoolExecutor. You can potentially subclass the JobExecutor and add it to your ProcessEngineCOnfiguration(Impl).&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've successfully implemented a commonJ-based POC for WebSphere that puts both, the job acquisition thread as well as the job execution within the JEE context by utilizing WorkItems/Work-Instances instead of direct threads in a threadPool. I currently do not use any of the pool features, as the work manager itself works as a queue based system.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My implemtation needs access to "private" API of the ProcessEngineConfiguration as I need to apply a different JobExecutor. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As the JobAquisitionThread implements Runnable, I've subclassed it and implemented the commonj.work.Work interface in this subclass. I'm not using the Runnable features at all, simply rely on the fact that the Work interface is affine to the Runnable interface. This is definitly not a good way, but I did not want to change too much here right now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All in all the changes are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;replace the default JobExecutor with my own implementation&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;inside the JobExecutor replace the JobAcqusitionThread again with my own implementation&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN&gt;Using this constellation, I'm able to successfully optain an EntityManager (or any other JNDI resource) within the second service task (the one AFTER the timer). The transaction built by Activiti is used in this case.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As java is not an allowed attachment extention I cannot attach the modified versions of the WorkManager as well as the JobAcqusitionThread (Work). Keep in mind, this is a POC, e.g. the WorkManager JNDI name is currently hard-coded. If someone is interested in this, drop me a line.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there any plans to provide a customizable API for the JobExecutor? In JEE contexts it is generally &lt;/SPAN&gt;&lt;STRONG&gt;forbidden&lt;/STRONG&gt;&lt;SPAN&gt; to create own threads/threadgroups, etc. thus other application servers my suffer from this situation as well. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If there is any need/interest, I would be glad to help to open the API at this part and provide a pluggable version that is able to work with threads (for plain Java SE environments), commonJ (for WebSphere and others that support it) or any other implementation. I think its possible to generalize the problem here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Drop me a line, if the team is interested. For now, I'll continue working with the POC to determine, if any other problems arise.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Heiko Kopp&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 13:42:56 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/accessing-business-data-via-jpa-before-and-after-timer/m-p/57547#M35013</guid>
      <dc:creator>bardioc</dc:creator>
      <dc:date>2011-10-10T13:42:56Z</dc:date>
    </item>
  </channel>
</rss>

