How to terminate process instance when timer is running?

cancel
Showing results for 
Search instead for 
Did you mean: 
maxlich
Active Member

How to terminate process instance when timer is running?

Hi all.
I am writing a service to work with an instance of the process. It has methods for creating a process, completing a user task, etc. Now I got to the method of destroying / stopping the process instance.I wrote such the method:

    @Override
    public void terminateProcessInstance(String processInstanceId) throws ActivitiServiceException {
        try {
            runtimeService.deleteProcessInstance(processInstanceId, "deleted by User");
        } catch (ActivitiObjectNotFoundException e) {
            e.printStackTrace();
            final String message = "There is no process instance with id = " + processInstanceId;
            logger.error(message, e);
            throw new ActivitiServiceException(message, e);
        } catch (Exception e) {
            e.printStackTrace();
            final String message = "There was an exception while terminating the process instance with id = " + processInstanceId + ": ";
            logger.error(message, e);
            throw new ActivitiServiceException(message, e);
        }
    }


And it does not work for me if the timer is running. There is an optimistic lock (in the Activiti engine).

How do I kill a process if the timer is running?

1 Reply
GlobCoder
Member II

Re: How to terminate process instance when timer is running?

Hi maxlich,

Did you find any solution for this ? Something to "clear" the timers before deletion?

As we are encoutering the exact same problem here, this would be of a great help!

Have a good day,

Victor