public void setRetriesFromPersistence(int retries) {
this.retries = retries;
}
protected void createFailedJobIncident() {
final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
if (processEngineConfiguration
.isCreateIncidentOnFailedJobEnabled()) {
String incidentHandlerType = FailedJobIncidentHandler.INCIDENT_HANDLER_TYPE;
// make sure job has an ID set:
if(id == null) {
id = processEngineConfiguration
.getIdGenerator()
.getNextId();
} else {
// check whether there exists already an incident
// for this job
List<Incident> failedJobIncidents = Context
.getCommandContext()
.getIncidentManager()
.findIncidentByConfigurationAndIncidentType(id, incidentHandlerType);
if (!failedJobIncidents.isEmpty()) {
return;
}
}
processEngineConfiguration
.getIncidentHandler(incidentHandlerType)
.handleIncident(getProcessDefinitionId(), null, executionId, id, exceptionMessage);
}
}