cancel
Showing results for 
Search instead for 
Did you mean: 

Ignoring ActivitiOptimisticLockingException: deleting job

workflowuser
Champ in-the-making
Champ in-the-making
Hi,

I have only script tasks in my workflow and am using multi-instance. I observed that the following exception is thrown many times after the script tasks have successfully executed.
Oct 25, 2011 1:18:47 AM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.activiti.engine.ActivitiOptimisticLockingException: ExecutionEntity[13] 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.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at com.dell.activiti.interceptors.RetryInterceptorImpl.execute(RetryInterceptorImpl.java:58)
   at org.activiti.engine.impl.jobexecutor.ExecuteJobsRunnable.run(ExecuteJobsRunnable.java:36)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
   at java.lang.Thread.run(Thread.java:662)

Since my delegate script tasks are successfully completed, I would like to ignore this exception (do not want to retry which re-executes the script tasks). I inserted an interceptor,  caught this exception? I tried to ignore it but found that i need to delete the job. Is there a way to delete a job that just threw ActivitiOptimisticLockingException?

// my interceptor
public <T> T execute(Command<T> command) {

try {

        // try to execute the command
        return next.execute(command);

      } catch (ActivitiOptimisticLockingException e) {
    // here command has job id but there is no accessor method.
   // if i could get jobid, i could delete the job
   // next.execute(new DeleteJobsCmd(jobid);
  }
}
2 REPLIES 2

workflowuser
Champ in-the-making
Champ in-the-making
any help is appreciated.

meditel
Champ in-the-making
Champ in-the-making
I have created a Jira : http://jira.codehaus.org/browse/ACT-966
Please vote.

BR,
Meditel