<?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 SpringJobExecutor cannot be shutdown and started up. in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138134#M96790</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wanted to understand this before I create a defect. Recently, I moved to using the SpringJobExecutor and found that I could not shut it down and restart it without booting up the process engine again. Ofcourse, I was experiencing this in my unit tests ( jobExecutor.start() in the setup method and jobExecutor.shutdown() in the teardown method) but wanted to understand the expected behavior.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;/** From SpringJobExecutor **/&lt;BR /&gt;@Override&lt;BR /&gt;protected void stopExecutingJobs() {&lt;BR /&gt;stopJobAcquisitionThread();&lt;BR /&gt;taskExecutor = null;&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;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe the developer (Pablo) that worked on &lt;/SPAN&gt;&lt;A href="https://jira.codehaus.org/browse/ACT-1258" rel="nofollow noopener noreferrer"&gt;https://jira.codehaus.org/browse/ACT-1258&lt;/A&gt;&lt;SPAN&gt; was following the pattern in the DefaultJobExecutor&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;/** From DefaultJobExecutor **/&lt;BR /&gt;protected void stopExecutingJobs() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; threadPoolExecutor = null;&lt;BR /&gt;&amp;nbsp; }&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;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;But the difference is that the DefaultJobExecutor instantiates&amp;nbsp; a new threadPoolExecutor&amp;nbsp; programmatically in its startExecutingJobs()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;/** From DefaultJobExecutor **/&lt;BR /&gt;protected void startExecutingJobs() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (threadPoolExecutor==null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; threadPoolExecutor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, 0L, TimeUnit.MILLISECONDS, threadPoolQueue);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; …&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; startJobAcquisitionThread(); &lt;BR /&gt;&amp;nbsp; }&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are my questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i) Why are we setting the ThreadPoolExecutor to null in the stopExecutingJobs() method in the DefaultJobExecutor?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ii) Considering that there is a good reason for i), does the same reason apply to SpringJobExecutor? I don't like that we are resetting a spring injected taskExecutor to null through code. This is not intuitive and took me some time to get to.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;iii) I would like the jobExecutor to be working as expected it has been shutdown and started again. I would recommend that we should not set the taskExecutor to null in the stopExecutingJobs() method. Optionally (and less preferably), we could also set a new TaskExecutor in the SpringJobExecutor's startExecutingJobs method. Thoughts?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sang&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Jan 2013 17:29:33 GMT</pubDate>
    <dc:creator>sangv</dc:creator>
    <dc:date>2013-01-09T17:29:33Z</dc:date>
    <item>
      <title>SpringJobExecutor cannot be shutdown and started up.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138134#M96790</link>
      <description>Hey Guys,I wanted to understand this before I create a defect. Recently, I moved to using the SpringJobExecutor and found that I could not shut it down and restart it without booting up the process engine again. Ofcourse, I was experiencing this in my unit tests ( jobExecutor.start() in the setup me</description>
      <pubDate>Wed, 09 Jan 2013 17:29:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138134#M96790</guid>
      <dc:creator>sangv</dc:creator>
      <dc:date>2013-01-09T17:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: SpringJobExecutor cannot be shutdown and started up.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138135#M96791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think this is a problem that grew historically. In the beginning, the threadPoolExecutor was not configurable but rather always created internally, using the passed in params for max/core pool sizes. A default ThreadPoolExecutor cannot be started again/reused after shutdown, AFAIK. When the spring-implementation was added, the existing behavior was not altered, rather just built upon.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So you're absolutely right about the fact that (especially in spring-case) it makes no sense to set the executor to null, since it's injected at the beginning, rather than created. The main problem is that the TaskExecutor interface has no start/shutdown methods available, so explicit start/shutdown of the executor is in spring's hands. Now that I look into this, the current implementation (setting task executor to null) doesn't have any effect and cannot guarantee that no jobs will be executed (which were in the executor queue) after job-executor was shut down.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll remove the taskExecutor = null call from the codebase…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 08:18:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138135#M96791</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2013-01-10T08:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: SpringJobExecutor cannot be shutdown and started up.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138136#M96792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sounds good (I am assuming that you don't need me to create a JIRA ticket for this, but let me know if otherwise).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sang&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 14:51:36 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138136#M96792</guid>
      <dc:creator>sangv</dc:creator>
      <dc:date>2013-01-10T14:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: SpringJobExecutor cannot be shutdown and started up.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138137#M96793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;No need for that, it's already pushed to master. Thanks for reporting!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2013 14:53:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138137#M96793</guid>
      <dc:creator>frederikherema1</dc:creator>
      <dc:date>2013-01-10T14:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: SpringJobExecutor cannot be shutdown and started up.</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138138#M96794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this query resolved ?&lt;/P&gt;&lt;P&gt;if yes, with which version, can I start stop job executor at run time now ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Paresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Jul 2017 13:20:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/springjobexecutor-cannot-be-shutdown-and-started-up/m-p/138138#M96794</guid>
      <dc:creator>jdp</dc:creator>
      <dc:date>2017-07-12T13:20:28Z</dc:date>
    </item>
  </channel>
</rss>

