AnsweredAssumed Answered

Ignoring ActivitiOptimisticLockingException: deleting job

Question asked by workflowuser on Oct 25, 2011
Latest reply on Oct 27, 2011 by meditel

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(
   at org.activiti.engine.impl.db.DbSqlSession.flush(
   at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(
   at org.activiti.engine.impl.interceptor.CommandContext.close(
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
   at java.util.concurrent.ThreadPoolExecutor$

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);