<?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 Thread sleep or timer? in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/thread-sleep-or-timer/m-p/182665#M135795</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a script task that will hit an API to check if a job is finished.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to keep checking the API every few minutes and if the job is not finished within an hour, I need to send a notification (but keep checking the API until it's finished).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;while (jobNotFinished) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; hit API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if (jobFinished) {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; } else {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; thread.sleep(5mins);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and I'll have a boundary timer event set to jobStartTime + 1hour to send a notification.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this the correct way? What would happen on a server restart if it's in the while loop?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've thought about having an exclusive gateway that will point back to the task but not sure how I would setup a boundary timer so that it doesn't run again when it keeps running the task every 5 mins even after 1hour has past. I could set a variable to mark it as sent, but that doesn't sound "right"?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any insight would be helpful to this BPMN noob. &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Mar 2015 00:13:42 GMT</pubDate>
    <dc:creator>jhahn</dc:creator>
    <dc:date>2015-03-19T00:13:42Z</dc:date>
    <item>
      <title>Thread sleep or timer?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-sleep-or-timer/m-p/182665#M135795</link>
      <description>Hi,I have a script task that will hit an API to check if a job is finished.I need to keep checking the API every few minutes and if the job is not finished within an hour, I need to send a notification (but keep checking the API until it's finished).while (jobNotFinished) {&amp;nbsp; hit API.&amp;nbsp; if (jobFinishe</description>
      <pubDate>Thu, 19 Mar 2015 00:13:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-sleep-or-timer/m-p/182665#M135795</guid>
      <dc:creator>jhahn</dc:creator>
      <dc:date>2015-03-19T00:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Thread sleep or timer?</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/thread-sleep-or-timer/m-p/182666#M135796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the describe implementation is correct. As long as the Boundary Timer Event is non interrupting (cancel activity property).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In case of a server restart and the scripttask (and perhaps other steps that are part of that transaction) isn’t finished the transaction will rollback. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So if f.e. the script task is async the process instance will continue there when the server is up.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yvo&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Mar 2015 12:47:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/thread-sleep-or-timer/m-p/182666#M135796</guid>
      <dc:creator>yvoswillens</dc:creator>
      <dc:date>2015-03-19T12:47:18Z</dc:date>
    </item>
  </channel>
</rss>

