As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
Nov 23, 2011 11:46:24 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deployINFO: Processing resource CheckForAFile.pngCheckForFile.execute() was called at Wed Nov 23 11:46:24 CST 2011CheckForFile.lookForFile() was called with thePathName = "C:\Users\thomacha\DataFiles\" and theFileName = "theFileToLookFor.txt".In CheckForFile.lookForFile() set fileFound = falseIn CheckForFile.execute() set fileExists = false.File does NOT exist.CheckForFile.execute() was called at Wed Nov 23 11:47:25 CST 2011CheckForFile.lookForFile() was called with thePathName = "C:\Users\thomacha\DataFiles\" and theFileName = "theFileToLookFor.txt".In CheckForFile.lookForFile() set fileFound = falseIn CheckForFile.execute() set fileExists = false.File does NOT exist.Nov 23, 2011 11:48:25 AM org.activiti.engine.impl.interceptor.CommandContext closeSEVERE: Error while closing command contextorg.activiti.engine.ActivitiOptimisticLockingException: TimerEntity[3424] was updated by another transaction concurrently at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:435) at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:348) at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147) at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:103) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49) at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40) at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) at org.activiti.engine.impl.jobexecutor.JobAcquisitionThread.run(JobAcquisitionThread.java:63)Nov 23, 2011 11:48:25 AM org.activiti.engine.impl.jobexecutor.JobAcquisitionThread runSEVERE: exception during job acquisition: TimerEntity[3424] was updated by another transaction concurrentlyorg.activiti.engine.ActivitiOptimisticLockingException: TimerEntity[3424] was updated by another transaction concurrently at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:435) at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:348) at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:147) at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:103) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:49) at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40) at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) at org.activiti.engine.impl.jobexecutor.JobAcquisitionThread.run(JobAcquisitionThread.java:63)Nov 23, 2011 11:48:25 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deployINFO: Processing resource CheckForAFile.bpmn20.xmlNov 23, 2011 11:48:25 AM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributesINFO: XMLSchema currently not supported as typeLanguageNov 23, 2011 11:48:25 AM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"> <process id="CheckForAFile" name="CheckForAFile"> <documentation>Place documentation for the 'CheckForAFile' process here.</documentation> <startEvent id="startevent1" name="Start"></startEvent> <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="checkFileExists"></sequenceFlow> <serviceTask id="checkFileExists" name="Check File Exists" activiti:class="opt.argo.com.CheckForFile"></serviceTask> <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway> <sequenceFlow id="flow2" name="" sourceRef="checkFileExists" targetRef="exclusivegateway1"></sequenceFlow> <sequenceFlow id="doesExist" name="Yes" sourceRef="exclusivegateway1" targetRef="logThatFileExists"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${fileExists == true}]]></conditionExpression> </sequenceFlow> <scriptTask id="logThatFileExists" name="Log That File Exists" scriptFormat="groovy"> <script><![CDATA[print "File does exist. \n"]]></script> </scriptTask> <sequenceFlow id="fileNotExist" name="File Does Not Exist" sourceRef="exclusivegateway1" targetRef="logThatFileNotExist"> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${fileExists != true}]]></conditionExpression> </sequenceFlow> <scriptTask id="logThatFileNotExist" name="Log That File Does Not Exist" scriptFormat="groovy"> <script><![CDATA[print "File does NOT exist. \n"]]></script> </scriptTask> <endEvent id="endevent1" name="End"></endEvent> <sequenceFlow id="flow3" name="" sourceRef="logThatFileExists" targetRef="endevent1"></sequenceFlow> <intermediateCatchEvent id="wait5minutes" name="Wait 5 Minutes"> <timerEventDefinition> <timeDuration>PT1M</timeDuration> </timerEventDefinition> </intermediateCatchEvent> <sequenceFlow id="flow4" name="" sourceRef="logThatFileNotExist" targetRef="wait5minutes"></sequenceFlow> <sequenceFlow id="flow5" name="" sourceRef="wait5minutes" targetRef="checkFileExists"></sequenceFlow> </process> <bpmndi:BPMNDiagram id="BPMNDiagram_CheckForAFile"> <bpmndi:BPMNPlane bpmnElement="CheckForAFile" id="BPMNPlane_CheckForAFile"> <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1"> <omgdc:Bounds height="35" width="35" x="150" y="220"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="checkFileExists" id="BPMNShape_checkFileExists"> <omgdc:Bounds height="55" width="105" x="230" y="210"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1"> <omgdc:Bounds height="40" width="40" x="430" y="217"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="logThatFileExists" id="BPMNShape_logThatFileExists"> <omgdc:Bounds height="55" width="105" x="520" y="120"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="logThatFileNotExist" id="BPMNShape_logThatFileNotExist"> <omgdc:Bounds height="55" width="105" x="520" y="300"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1"> <omgdc:Bounds height="35" width="35" x="760" y="220"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNShape bpmnElement="wait5minutes" id="BPMNShape_wait5minutes"> <omgdc:Bounds height="35" width="35" x="265" y="400"></omgdc:Bounds> </bpmndi:BPMNShape> <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1"> <omgdi:waypoint x="185" y="237"></omgdi:waypoint> <omgdi:waypoint x="230" y="237"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2"> <omgdi:waypoint x="335" y="237"></omgdi:waypoint> <omgdi:waypoint x="430" y="237"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="doesExist" id="BPMNEdge_doesExist"> <omgdi:waypoint x="450" y="217"></omgdi:waypoint> <omgdi:waypoint x="450" y="147"></omgdi:waypoint> <omgdi:waypoint x="520" y="147"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="fileNotExist" id="BPMNEdge_fileNotExist"> <omgdi:waypoint x="450" y="257"></omgdi:waypoint> <omgdi:waypoint x="450" y="327"></omgdi:waypoint> <omgdi:waypoint x="520" y="327"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3"> <omgdi:waypoint x="625" y="147"></omgdi:waypoint> <omgdi:waypoint x="777" y="147"></omgdi:waypoint> <omgdi:waypoint x="777" y="220"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4"> <omgdi:waypoint x="572" y="355"></omgdi:waypoint> <omgdi:waypoint x="572" y="417"></omgdi:waypoint> <omgdi:waypoint x="300" y="417"></omgdi:waypoint> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5"> <omgdi:waypoint x="282" y="400"></omgdi:waypoint> <omgdi:waypoint x="282" y="265"></omgdi:waypoint> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </definitions>
<?xml version="1.0" encoding="UTF-8"?><br><definitions xmlns="<a href="http://www.omg.org/spec/BPMN/20100524/MODEL" rel="nofollow noopener noreferrer">http://www.omg.org/spec/BPMN/20100524/MODEL</a>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" rel="nofollow noopener noreferrer">http://www.w3.org/2001/XMLSchema-instance</a>" xmlns:activiti="<a href="http://activiti.org/bpmn" rel="nofollow noopener noreferrer">http://activiti.org/bpmn</a>" xmlns:bpmndi="<a href="http://www.omg.org/spec/BPMN/20100524/DI" rel="nofollow noopener noreferrer">http://www.omg.org/spec/BPMN/20100524/DI</a>" xmlns:smileysurprised:mgdc="<a href="http://www.omg.org/spec/DD/20100524/DC" rel="nofollow noopener noreferrer">http://www.omg.org/spec/DD/20100524/DC</a>" xmlns:smileysurprised:mgdi="<a href="http://www.omg.org/spec/DD/20100524/DI" rel="nofollow noopener noreferrer">http://www.omg.org/spec/DD/20100524/DI</a>" typeLanguage="<a href="http://www.w3.org/2001/XMLSchema" rel="nofollow noopener noreferrer">http://www.w3.org/2001/XMLSchema</a>" expressionLanguage="<a href="http://www.w3.org/1999/XPath" rel="nofollow noopener noreferrer">http://www.w3.org/1999/XPath</a>" targetNamespace="<a href="http://www.activiti.org/test" rel="nofollow noopener noreferrer">http://www.activiti.org/test</a>"><br> <process id="CheckForAFile" name="CheckForAFile"><br> <documentation>Process loops as long as variable 'fileExists' is false.</documentation><br> <startEvent id="startevent1" name="Start"></startEvent><br> <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="checkFileExists"></sequenceFlow><br> <serviceTask id="checkFileExists" name="Check File Exists" activiti:class="com.bigfirm.CheckForFile"></serviceTask><br> <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway><br> <sequenceFlow id="flow2" name="" sourceRef="checkFileExists" targetRef="exclusivegateway1"></sequenceFlow><br> <sequenceFlow id="doesExist" name="Yes" sourceRef="exclusivegateway1" targetRef="logThatFileExists"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${fileExists == true}]]></conditionExpression><br> </sequenceFlow><br> <scriptTask id="logThatFileExists" name="Log That File Exists" scriptFormat="groovy"><br> <script><![CDATA[print "File does exist. \n"]]></script><br> </scriptTask><br> <sequenceFlow id="fileNotExist" name="File Does Not Exist" sourceRef="exclusivegateway1" targetRef="logThatFileNotExist"><br> <conditionExpression xsi:type="tFormalExpression"><![CDATA[${fileExists != true}]]></conditionExpression><br> </sequenceFlow><br> <scriptTask id="logThatFileNotExist" name="Log That File Does Not Exist" scriptFormat="groovy"><br> <script><![CDATA[print "File does NOT exist. \n"]]></script><br> </scriptTask><br> <sequenceFlow id="flow3" name="" sourceRef="logThatFileExists" targetRef="endevent1"></sequenceFlow><br> <intermediateCatchEvent id="waitAMinute" name="Wait one minutes"><br> <timerEventDefinition><br> <timeDuration>PT1S</timeDuration><br> </timerEventDefinition><br> </intermediateCatchEvent><br> <sequenceFlow id="flow4" name="" sourceRef="logThatFileNotExist" targetRef="waitAMinute"></sequenceFlow><br> <sequenceFlow id="flow5" name="" sourceRef="waitAMinute" targetRef="checkFileExists"></sequenceFlow><br> <endEvent id="endevent1" name="End"></endEvent><br> </process><br></definitions>
…extends PluggableActivitiTestCase {<br> public void testLoopWaitForFile() {<br> Map<String, Object> variables = new HashMap<String, Object>();<br> variables.put("fileExists", false);<br><br> ProcessInstance pi = runtimeService<br> .startProcessInstanceByKey("CheckForAFile", variables);<br> assertNotNull(pi);<br><br> assertTrue(<br> "History is turned off",<br> config.getHistoryLevel() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE);<br><br> /*<br> * assert process is in the wait state<br> */<br> Execution execution = runtimeService.createExecutionQuery()<br> .processInstanceId(pi.getId()).activityId("waitAMinute")<br> .singleResult();<br> assertNotNull("Process is not in the wait state as expected.",<br> execution);<br><br> long startTime = System.currentTimeMillis();<br><br> boolean fileCreated = false;<br> File file = null;<br> while (pi != null && !fileCreated) {<br> try {<br> Thread.sleep(1000);<br> } catch (InterruptedException e) {<br> fail("Test was interrupted.");<br> }<br> if (System.currentTimeMillis() - startTime > 1000) {<br> file = new File("bin/com/…/res/testWaitForFile");<br> try {<br> file.createNewFile();<br> } catch (IOException e) {<br> fail("Unable to create new file.\n"<br> + PrintHelper.getStackTrace(e));<br> }<br> try {<br> Thread.sleep(2 * 1000);<br> } catch (InterruptedException e) {<br> fail("Test was interrupted.");<br> }<br> fileCreated = true;<br> }<br> }<br><br> while(System.currentTimeMillis() - startTime < 3 * 60 * 1000){<br><br> try {<br> Thread.sleep(1000);<br> } catch (InterruptedException e) {<br> // TODO Auto-generated catch block<br> e.printStackTrace();<br> }<br> }<br> if (null != file) {<br> file.delete();<br> }<br> pi = runtimeService.createProcessInstanceQuery().singleResult();<br> HistoricProcessInstance hpi = historyService<br> .createHistoricProcessInstanceQuery().singleResult();<br> assertNull(pi);<br> assertNotNull(hpi);<br> assertEquals("End activity endevent1 not reached.", "endevent1",<br> hpi.getEndActivityId());<br><br> }<br>…<br>
<br>My delegate class:<br>public class CheckForFile implements JavaDelegate {<br><br> @Override<br> public void execute(DelegateExecution execution) throws Exception {<br> boolean fileExists = false;<br> <br> URL resource = this.getClass().getClassLoader().getResource(<br> "com/…/res/testWaitForFile");<br> <br> if (resource != null) {<br> File file = new File(resource.toURI());<br> if (file.exists()) {<br> fileExists = true;<br> }<br> }<br> //execution.setVariable("fileExists", fileExists);<br> }<br><br>}
File does NOT exist. <br>File does NOT exist. <br>File does NOT exist. <br>File does NOT exist. <br>File does NOT exist.
execution.setVariable("fileExists", fileExists);
<br>SELECT * FROM ACT_HI_ACTINST;<br>ID_ PROC_DEF_ID_ PROC_INST_ID_ EXECUTION_ID_ ACT_ID_ ACT_NAME_ ACT_TYPE_ ASSIGNEE_ START_TIME_ END_TIME_ DURATION_ <br>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<br>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<br>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<br>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<br>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<br>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<br>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<br>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<br>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<br>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