I have a simple circuit consisting of a timer with a Cycle type and a cron value 0 5 * * * ?
I attached a photo of this scheme below.
This is followed by JavaDelegate, which downloads data from AD and performs some data manipulation. Heavy business logic is running, which runs in 23,000,000 milliseconds = 6.5 hours. Since the timer starts every hour, in order to avoid cases when the process is still running and the second one starts in parallel, I, inside the delegate used in the service-task, stop all parallel processes and give them to camunda with the status DONE
public void pullAllScheduled() {
if (!alreadyExecuted.compareAndSet(false, true)) {
log.info("Импорт из АФ уже запущен, процесс завершен успешно.");
return;
}
try {
doImport();
} catch (Exception ex) {
log.error("Ошибка при выполнении импорта: {}", ex.getMessage(), ex);
} finally {
alreadyExecuted.set(false);
}
}
...
scheduleAudit.setProcessStatus(ScheduleAudit.Status.DONE);
...
I also attach my class implementing the JavaDelegate interface, its structure will be needed for further analysis
@Component("pullFactDelegate")
@AllArgsConstructor
@Slf4j
public class PullFactDelegate implements JavaDelegate {
private FactScheduler factScheduler;
private ScheduleAuditRepository scheduleAuditRepository;
private RepositoryService repositoryService;
@PostConstruct
public void init() {
log.info("PullFactDelegate создан и готов к использованию");
}
@Override
public void execute(DelegateExecution execution) throws Exception {
final ProcessDefinition processDefinition =
repositoryService.createProcessDefinitionQuery()
.processDefinitionId(execution.getProcessDefinitionId())
.singleResult();
try {
new ActivFactoringImportLogic(factScheduler,
scheduleAuditRepository).run(processDefinition.getId(),
processDefinition.getName(),
execution.getProcessInstanceId());
log.info("Импорт завершен успешно");
} catch (Exception e) {
log.error("Ошибка импорта {}", e.getMessage(), e);
}
}
}
Regardless of the time it takes to complete the business logic, I get the log log.info (“Import completed successfully”);
Due to this, it can be concluded that my delegate is running successfully.
However, after receiving this log, I get an error from the keylock API. I attach the trace of the error in the screenshot format, unfortunately, I cannot send it in text
The last line contains the ID of a specific process, I will clarify that this is the ID of the original process. I mean, there is an initial process that started, in parallel with it, more instances of this process are trying to start, which I stop, I get an error for the initial process.
I have a duplicate process (the main process IDs are different) that does not have a timer and is started manually by the user. No matter how many times in a row I run this process, it always runs successfully. I assume that there is a problem with the timer, the error indicates this, but I can’t find the reason
Can you tell me where to look for the cause of the error?