Java Code Examples for org.camunda.bpm.engine.impl.persistence.entity.JobEntity#setRetries()

The following examples show how to use org.camunda.bpm.engine.impl.persistence.entity.JobEntity#setRetries() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSetJobRetriesCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void setJobRetriesByJobId(String jobId, int retries, CommandContext commandContext) {
  JobEntity job = commandContext
      .getJobManager()
      .findJobById(jobId);
  if (job != null) {
    for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
      checker.checkUpdateRetriesJob(job);
    }

    if (job.isInInconsistentLockState()) {
      job.resetLock();
    }
    int oldRetries = job.getRetries();
    job.setRetries(retries);

    PropertyChange propertyChange = new PropertyChange(RETRIES, oldRetries, job.getRetries());
    commandContext.getOperationLogManager().logJobOperation(getLogEntryOperation(), job.getId(),
        job.getJobDefinitionId(), job.getProcessInstanceId(), job.getProcessDefinitionId(),
        job.getProcessDefinitionKey(), propertyChange);
  } else {
    throw new ProcessEngineException("No job found with id '" + jobId + "'.");
  }

}
 
Example 2
Source File: DefaultJobRetryCmd.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected void initializeRetries(JobEntity job, int retries) {
  LOG.debugInitiallyAppyingRetryCycleForJob(job.getId(), retries);
  job.setRetries(retries);
}
 
Example 3
Source File: JobRetryCmd.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected void decrementRetries(JobEntity job) {
  if (exception == null || shouldDecrementRetriesFor(exception)) {
    job.setRetries(job.getRetries() - 1);
  }
}