<?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: Problem Using Timer to Delay Re-executing Service Task in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/problem-using-timer-to-delay-re-executing-service-task/m-p/63715#M40023</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really appreciate your taking the time to test this process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A couple of things come to mind.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does running your unit test create its own process engine?&amp;nbsp; Could you try launching the process by a user (say, kermit) within Activiti Explorer and use the same engine Explorer uses?&amp;nbsp; The exception I got suggested the the timer I was using was updated by another transaction concurrently with my process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[size=85](Nov 23, 2011 11:48:25 AM org.activiti.engine.impl.interceptor.CommandContext close&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SEVERE: Error while closing command context&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;org.activiti.engine.ActivitiOptimisticLockingException: &lt;/SPAN&gt;&lt;SPAN style="color:#400000;"&gt;TimerEntity[3424] was updated by another tra&lt;BR /&gt;nsaction concurrently&lt;/SPAN&gt;&lt;SPAN&gt;at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:435)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:348)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)[/size]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure running a unit test exposes the timer to possible updates by other transactions the way running within Explorer may.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second thing, the timers.&amp;nbsp; Could you remove the sleeps in your code, just launch the process, and let the intermediate timer (waitAMinute, redefined to a delay of one minute rather than one second) be the only controller of looping through the process?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for checking this out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Dec 2011 14:51:08 GMT</pubDate>
    <dc:creator>ct1</dc:creator>
    <dc:date>2011-12-02T14:51:08Z</dc:date>
    <item>
      <title>Problem Using Timer to Delay Re-executing Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-using-timer-to-delay-re-executing-service-task/m-p/63713#M40021</link>
      <description>I am trying to call a Service task that checks for the existance of a file.&amp;nbsp; I want the Service task to run, wait 5 minutes, and run again, until the file is found.The Timer duration is set to PT1M.When I start the process. The service task runs, logs its start, fails to find the file, waits, runs a</description>
      <pubDate>Wed, 23 Nov 2011 19:57:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-using-timer-to-delay-re-executing-service-task/m-p/63713#M40021</guid>
      <dc:creator>ct1</dc:creator>
      <dc:date>2011-11-23T19:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Using Timer to Delay Re-executing Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-using-timer-to-delay-re-executing-service-task/m-p/63714#M40022</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 tried your process:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;BR /&gt;&amp;lt;definitions xmlns="&lt;A href="http://www.omg.org/spec/BPMN/20100524/MODEL" rel="nofollow noopener noreferrer"&gt;http://www.omg.org/spec/BPMN/20100524/MODEL&lt;/A&gt;" xmlns:xsi="&lt;A href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow noopener noreferrer"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/A&gt;" xmlns:activiti="&lt;A href="http://activiti.org/bpmn" rel="nofollow noopener noreferrer"&gt;http://activiti.org/bpmn&lt;/A&gt;" xmlns:bpmndi="&lt;A href="http://www.omg.org/spec/BPMN/20100524/DI" rel="nofollow noopener noreferrer"&gt;http://www.omg.org/spec/BPMN/20100524/DI&lt;/A&gt;" xmlns:smileysurprised:mgdc="&lt;A href="http://www.omg.org/spec/DD/20100524/DC" rel="nofollow noopener noreferrer"&gt;http://www.omg.org/spec/DD/20100524/DC&lt;/A&gt;" xmlns:smileysurprised:mgdi="&lt;A href="http://www.omg.org/spec/DD/20100524/DI" rel="nofollow noopener noreferrer"&gt;http://www.omg.org/spec/DD/20100524/DI&lt;/A&gt;" typeLanguage="&lt;A href="http://www.w3.org/2001/XMLSchema" rel="nofollow noopener noreferrer"&gt;http://www.w3.org/2001/XMLSchema&lt;/A&gt;" expressionLanguage="&lt;A href="http://www.w3.org/1999/XPath" rel="nofollow noopener noreferrer"&gt;http://www.w3.org/1999/XPath&lt;/A&gt;" targetNamespace="&lt;A href="http://www.activiti.org/test" rel="nofollow noopener noreferrer"&gt;http://www.activiti.org/test&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;process id="CheckForAFile" name="CheckForAFile"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;documentation&amp;gt;Process loops as long as variable 'fileExists' is false.&amp;lt;/documentation&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;startEvent id="startevent1" name="Start"&amp;gt;&amp;lt;/startEvent&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="checkFileExists"&amp;gt;&amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;serviceTask id="checkFileExists" name="Check File Exists" activiti:class="com.bigfirm.CheckForFile"&amp;gt;&amp;lt;/serviceTask&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"&amp;gt;&amp;lt;/exclusiveGateway&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="flow2" name="" sourceRef="checkFileExists" targetRef="exclusivegateway1"&amp;gt;&amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="doesExist" name="Yes" sourceRef="exclusivegateway1" targetRef="logThatFileExists"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;conditionExpression xsi:type="tFormalExpression"&amp;gt;&amp;lt;![CDATA[${fileExists == true}]]&amp;gt;&amp;lt;/conditionExpression&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;scriptTask id="logThatFileExists" name="Log That File Exists" scriptFormat="groovy"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script&amp;gt;&amp;lt;![CDATA[print "File does exist. \n"]]&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/scriptTask&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="fileNotExist" name="File Does Not Exist" sourceRef="exclusivegateway1" targetRef="logThatFileNotExist"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;conditionExpression xsi:type="tFormalExpression"&amp;gt;&amp;lt;![CDATA[${fileExists != true}]]&amp;gt;&amp;lt;/conditionExpression&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;scriptTask id="logThatFileNotExist" name="Log That File Does Not Exist" scriptFormat="groovy"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script&amp;gt;&amp;lt;![CDATA[print "File does NOT exist. \n"]]&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/scriptTask&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="flow3" name="" sourceRef="logThatFileExists" targetRef="endevent1"&amp;gt;&amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;intermediateCatchEvent id="waitAMinute" name="Wait one minutes"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;timerEventDefinition&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;timeDuration&amp;gt;PT1S&amp;lt;/timeDuration&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/timerEventDefinition&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/intermediateCatchEvent&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="flow4" name="" sourceRef="logThatFileNotExist" targetRef="waitAMinute"&amp;gt;&amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;sequenceFlow id="flow5" name="" sourceRef="waitAMinute" targetRef="checkFileExists"&amp;gt;&amp;lt;/sequenceFlow&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;endEvent id="endevent1" name="End"&amp;gt;&amp;lt;/endEvent&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;/process&amp;gt;&lt;BR /&gt;&amp;lt;/definitions&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;with a unit test:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;…extends PluggableActivitiTestCase {&lt;BR /&gt; public void testLoopWaitForFile() {&lt;BR /&gt;&amp;nbsp; Map&amp;lt;String, Object&amp;gt; variables = new HashMap&amp;lt;String, Object&amp;gt;();&lt;BR /&gt;&amp;nbsp; variables.put("fileExists", false);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; ProcessInstance pi = runtimeService&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .startProcessInstanceByKey("CheckForAFile", variables);&lt;BR /&gt;&amp;nbsp; assertNotNull(pi);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; assertTrue(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "History is turned off",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; config.getHistoryLevel() &amp;gt; ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; /*&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * assert process is in the wait state&lt;BR /&gt;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp; Execution execution = runtimeService.createExecutionQuery()&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .processInstanceId(pi.getId()).activityId("waitAMinute")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .singleResult();&lt;BR /&gt;&amp;nbsp; assertNotNull("Process is not in the wait state as expected.",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; execution);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; long startTime = System.currentTimeMillis();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; boolean fileCreated = false;&lt;BR /&gt;&amp;nbsp; File file = null;&lt;BR /&gt;&amp;nbsp; while (pi != null &amp;amp;&amp;amp; !fileCreated) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.sleep(1000);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; } catch (InterruptedException e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fail("Test was interrupted.");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if (System.currentTimeMillis() - startTime &amp;gt; 1000) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; file = new File("bin/com/…/res/testWaitForFile");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file.createNewFile();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (IOException e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fail("Unable to create new file.\n"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + PrintHelper.getStackTrace(e));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.sleep(2 * 1000);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } catch (InterruptedException e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fail("Test was interrupted.");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileCreated = true;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; while(System.currentTimeMillis() - startTime &amp;lt; 3 * 60 * 1000){&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thread.sleep(1000);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; } catch (InterruptedException e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated catch block&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; if (null != file) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; file.delete();&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; pi = runtimeService.createProcessInstanceQuery().singleResult();&lt;BR /&gt;&amp;nbsp; HistoricProcessInstance hpi = historyService&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .createHistoricProcessInstanceQuery().singleResult();&lt;BR /&gt;&amp;nbsp; assertNull(pi);&lt;BR /&gt;&amp;nbsp; assertNotNull(hpi);&lt;BR /&gt;&amp;nbsp; assertEquals("End activity endevent1 not reached.", "endevent1",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; hpi.getEndActivityId());&lt;BR /&gt;&lt;BR /&gt; }&lt;BR /&gt;…&lt;BR /&gt;&lt;/CODE&gt;&lt;CODE&gt;&lt;BR /&gt;My delegate class:&lt;BR /&gt;public class CheckForFile implements JavaDelegate {&lt;BR /&gt;&lt;BR /&gt; @Override&lt;BR /&gt; public void execute(DelegateExecution execution) throws Exception {&lt;BR /&gt;&amp;nbsp; boolean fileExists = false;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; URL resource = this.getClass().getClassLoader().getResource(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "com/…/res/testWaitForFile");&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; if (resource != null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; File file = new File(resource.toURI());&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if (file.exists()) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileExists = true;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp; //execution.setVariable("fileExists", fileExists);&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;}&lt;/CODE&gt;&lt;SPAN&gt;It would be run forever if I the unit test would not stop after tree minutes. It prints continually:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;File does NOT exist. &lt;BR /&gt;File does NOT exist. &lt;BR /&gt;File does NOT exist. &lt;BR /&gt;File does NOT exist. &lt;BR /&gt;File does NOT exist. &lt;/CODE&gt;&lt;SPAN&gt;If I uncomment the line in the listener everything is working fine:&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;execution.setVariable("fileExists", fileExists);&lt;/CODE&gt;&lt;SPAN&gt;The history tables then look like this:&lt;/SPAN&gt;&lt;CODE&gt;&lt;BR /&gt;SELECT * FROM ACT_HI_ACTINST;&lt;BR /&gt;ID_&amp;nbsp;&amp;nbsp; PROC_DEF_ID_&amp;nbsp;&amp;nbsp; PROC_INST_ID_&amp;nbsp;&amp;nbsp; EXECUTION_ID_&amp;nbsp;&amp;nbsp; ACT_ID_&amp;nbsp;&amp;nbsp; ACT_NAME_&amp;nbsp;&amp;nbsp; ACT_TYPE_&amp;nbsp;&amp;nbsp; ASSIGNEE_&amp;nbsp;&amp;nbsp; START_TIME_&amp;nbsp;&amp;nbsp; END_TIME_&amp;nbsp;&amp;nbsp; DURATION_&amp;nbsp; &lt;BR /&gt;319 CheckForAFile:1:317 318 318 startevent1 Start startEvent null 2011-12-02 09:29:32.415 2011-12-02 09:29:32.415 0&lt;BR /&gt;322 CheckForAFile:1:317 318 318 checkFileExists Check File Exists serviceTask null 2011-12-02 09:29:32.415 2011-12-02 09:29:32.415 0&lt;BR /&gt;324 CheckForAFile:1:317 318 318 exclusivegateway1 Exclusive Gateway exclusiveGateway null 2011-12-02 09:29:32.415 2011-12-02 09:29:32.415 0&lt;BR /&gt;325 CheckForAFile:1:317 318 318 logThatFileNotExist Log That File Does Not Exist scriptTask null 2011-12-02 09:29:32.415 2011-12-02 09:29:32.43 15&lt;BR /&gt;328 CheckForAFile:1:317 318 318 checkFileExists Check File Exists serviceTask null 2011-12-02 09:30:32.467 2011-12-02 09:30:32.467 0&lt;BR /&gt;330 CheckForAFile:1:317 318 318 exclusivegateway1 Exclusive Gateway exclusiveGateway null 2011-12-02 09:30:32.467 2011-12-02 09:30:32.467 0&lt;BR /&gt;331 CheckForAFile:1:317 318 318 logThatFileNotExist Log That File Does Not Exist scriptTask null 2011-12-02 09:30:32.467 2011-12-02 09:30:32.498 31&lt;BR /&gt;334 CheckForAFile:1:317 318 318 checkFileExists Check File Exists serviceTask null 2011-12-02 09:31:32.535 2011-12-02 09:31:32.535 0&lt;BR /&gt;336 CheckForAFile:1:317 318 318 exclusivegateway1 Exclusive Gateway exclusiveGateway null 2011-12-02 09:31:32.535 2011-12-02 09:31:32.535 0&lt;BR /&gt;337 CheckForAFile:1:317 318 318 logThatFileExists Log That File Exists scriptTask null 2011-12-02 09:31:32.535 2011-12-02 09:31:32.551 16&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;Best Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Michael&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2011 13:31:06 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-using-timer-to-delay-re-executing-service-task/m-p/63714#M40022</guid>
      <dc:creator>mhw</dc:creator>
      <dc:date>2011-12-02T13:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Using Timer to Delay Re-executing Service Task</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/problem-using-timer-to-delay-re-executing-service-task/m-p/63715#M40023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really appreciate your taking the time to test this process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A couple of things come to mind.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does running your unit test create its own process engine?&amp;nbsp; Could you try launching the process by a user (say, kermit) within Activiti Explorer and use the same engine Explorer uses?&amp;nbsp; The exception I got suggested the the timer I was using was updated by another transaction concurrently with my process.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[size=85](Nov 23, 2011 11:48:25 AM org.activiti.engine.impl.interceptor.CommandContext close&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SEVERE: Error while closing command context&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;org.activiti.engine.ActivitiOptimisticLockingException: &lt;/SPAN&gt;&lt;SPAN style="color:#400000;"&gt;TimerEntity[3424] was updated by another tra&lt;BR /&gt;nsaction concurrently&lt;/SPAN&gt;&lt;SPAN&gt;at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:435)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:348)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;)[/size]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure running a unit test exposes the timer to possible updates by other transactions the way running within Explorer may.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The second thing, the timers.&amp;nbsp; Could you remove the sleeps in your code, just launch the process, and let the intermediate timer (waitAMinute, redefined to a delay of one minute rather than one second) be the only controller of looping through the process?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again for checking this out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Dec 2011 14:51:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/problem-using-timer-to-delay-re-executing-service-task/m-p/63715#M40023</guid>
      <dc:creator>ct1</dc:creator>
      <dc:date>2011-12-02T14:51:08Z</dc:date>
    </item>
  </channel>
</rss>

