}
if (log.isLoggable(Level.FINE)) {
log.fine("Executing job " + jobId);
}
JobEntity job = commandContext
.getJobManager()
.findJobById(jobId);
if (job == null) {
throw new JobNotFoundException(jobId);
}
JobExecutorContext jobExecutorContext = Context.getJobExecutorContext();
if(jobExecutorContext != null) { // if null, then we are not called by the job executor
jobExecutorContext.setCurrentJob(job);
}
try {
job.execute(commandContext);
} catch (RuntimeException exception) {
// When transaction is rolled back, decrement retries
CommandExecutor commandExecutor = Context
.getProcessEngineConfiguration()
.getCommandExecutorTxRequiresNew();