Job Modification

Hi guys,

I am updating timer due date in service task using ManagementService based on Philipp_Ossler’s answer here Update Timer using the Java API

Everything works perfectly, but sometimes, based on some conditions, I have to suspend/activate timer job and when I use any combination (suspend + set due date, set due date + activate), I get infinite optimistic locking exceptions:

ENGINE-03005 Execution of ‘UPDATE TimerEntity[…]’ failed. Entity was updated by another transaction concurrently.

Here’s the sample project: GitHub - jikhvadze/TimerModificationSample

Please, can anybody tell me what I’m doing wrong. Thanks in advance.

@jikhvadze why do you want to suspend the job, without suspending the job updating timer having any problems? try like below without suspending the job.

public void execute(DelegateExecution delegateExecution) throws Exception {
    Job timerJob = managementService.createJobQuery()

    managementService.setJobDuedate(timerJob.getId(), new Date(System.currentTimeMillis() + 2000));

@aravindhrs, thanks for answer. I am not suspending the process, I am suspending the job. As I already mentioned, calling only setJobDuedate works without problems, but I do need to call suspend/activate JOB alongside in some cases.