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.
<br>Example: process will start 4 times, in 5 minute intervals, starting on 11th march 2011, 12:13<br><br> <startEvent id="theStart"><br> <timerEventDefinition><br> <timeCycle>R4/2011-03-11T12:13/PT5M</timeCycle><br> </timerEventDefinition><br> </startEvent><br> <br>Example: process will start once, on selected date<br><br> <startEvent id="theStart"><br> <timerEventDefinition><br> <timeDate>2011-03-11T12:13:14</timeDate><br> </timerEventDefinition><br> </startEvent><br> <br>
<br><startEvent id="InicioViajeros" name="Inicio de proceso de viajeros - 15 PM"><br> <timerEventDefinition><br> <timeCycle>R1000/2012-12-11T15:00:00-03/P1D</timeCycle><br> </timerEventDefinition><br> </startEvent><br>
<timeCycle>R1000/2012-12-11T15:00:00-03/P1D</timeCycle>
select * from ACT_RU_JOB where HANDLER_CFG_<>'VerificarExistenciaSuscripcionTrial';
ID_ REV_ TYPE_ LOCK_EXP_TIME_ LOCK_OWNER_ EXCLUSIVE_ EXECUTION_ID_ PROCESS_INSTANCE_ID_ PROC_DEF_ID_ RETRIES_ EXCEPTION_STACK_ID_ EXCEPTION_MSG_ DUEDATE_ REPEAT_ HANDLER_TYPE_ HANDLER_CFG_349640 8 timer 2012-12-22 14:05:00 64e9e6c3-d0fd-4994-b126-42dfd44f26ee 1 NULL NULL NULL 1 NULL NULL 2012-12-22 13:30:00 0 30 13 * * ? timer-start-event EnvioMensajesSinR
SEVERE: Error while closing command contextorg.activiti.engine.ActivitiOptimisticLockingException: TimerEntity[349640] was updated by another transaction concurrently at org.activiti.engine.impl.db.DbSqlSession$DeletePersistentObjectOperation.execute(DbSqlSession.java:238) at org.activiti.engine.impl.db.DbSqlSession.flushDeletes(DbSqlSession.java:667) at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:461) at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:167) at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:114) at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:69) 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:32) at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:679)Exception in thread "pool-1-thread-5" org.activiti.engine.ActivitiOptimisticLockingException: TimerEntity[349640] was updated by another transaction concurrently at org.activiti.engine.impl.db.DbSqlSession$DeletePersistentObjectOperation.execute(DbSqlSession.java:238)
// It only makes sense to check for optimistic locking exceptions for objects that actually have a revision<br> if (persistentObject instanceof HasRevision) {<br> int nrOfRowsDeleted = sqlSession.delete(deleteStatement, persistentObject);<br> if (nrOfRowsDeleted == 0) {<br> throw new ActivitiOptimisticLockingException(DbSqlSession.this.toString(persistentObject) + " was updated by another transaction concurrently");<br> }<br> } else {<br> sqlSession.delete(deleteStatement, persistentObject);<br> }
<br><!– JOB DELETE STATEMENTS–><br><br> <delete id="deleteJob" parameterType="org.activiti.engine.impl.persistence.entity.JobEntity"><br> delete from ${prefix}ACT_RU_JOB where ID_ = #{id} and REV_ = #{revision}<br> </delete><br> <br> <delete id="deleteTimer" parameterType="org.activiti.engine.impl.persistence.entity.JobEntity"><br> delete from ${prefix}ACT_RU_JOB where ID_ = #{id} and REV_ = #{revision}<br> </delete><br> <br> <delete id="deleteMessage" parameterType="org.activiti.engine.impl.persistence.entity.JobEntity"><br> delete from ${prefix}ACT_RU_JOB where ID_ = #{id} and REV_ = #{revision}<br> </delete><br>
<br>@Override<br> public void execute(CommandContext commandContext) {<br><br> super.execute(commandContext);<br><br> if (repeat == null) {<br><br> if (log.isLoggable(Level.FINE)) {<br> log.fine("Timer " + getId() + " fired. Deleting timer.");<br> }<br> delete();<br> } else {<br> delete();<br> Date newTimer = calculateRepeat();<br> if (newTimer != null) {<br> TimerEntity te = new TimerEntity(this);<br> te.setDuedate(newTimer);<br> Context<br> .getCommandContext()<br> .getJobManager()<br> .schedule(te);<br> }<br> }<br><br> }<br><br> private Date calculateRepeat() {<br> BusinessCalendar businessCalendar = Context<br> .getProcessEngineConfiguration()<br> .getBusinessCalendarManager()<br> .getBusinessCalendar(CycleBusinessCalendar.NAME);<br> return businessCalendar.resolveDuedate(repeat);<br> }<br>
Okay, does the job succeed or does it run into an error (OptimisticLockingException for example)?How long does the job need to execute? Is it only starting a process instance and executing a few automatic service tasks that run very quickly? Or does starting the process instance take very long (> 30 seconds) ?Best regards,
Okay then I understand. While the process is sending the e-mails, the transaction is not committed yet.Because we have a default job lock interval of 5 minutes, if a job takes longer than 5 minutes, the job executor will try the same job again because it expects that something went wrong.If you can't refactor the process to keep the execution under 5 minutes, the best way to go forward is to increase the lockTimeInMillis to some value in which the job is definitely executed.Although my advice would be to reduce the synchronous job execution time if possible using for example async handling.Best regards,
o what you are saying is I should modify either this on the code protected int lockTimeInMillis = 5 * 60 * 1000; in JobExecutor.javaor change my process to support asynchronous execution. I believe that, for me, it's best to change both actually, right?
o what you are saying is I should modify either this on the code protected int lockTimeInMillis = 5 * 60 * 1000; in JobExecutor.javaor change my process to support asynchronous execution. I believe that, for me, it's best to change both actually, right?There is a setter for the lockTimeMillis on the JobExecutor. Retrieve the job executor by casting the process engine to ProcessEngineImpl and set the timing accordingly.Alternatively (and maybe cleaner) you can inject your own JobExecutor impl (extending the default one) on the ProcessEngineCOnfiguration (ie in your activiti.cfg.xml).
What do you think about changing asynchronous (to true) and exclusive ( to false) to the subprocess ?