private void register(JobFactory jobFactory) { jobFactoryRegistry.registerJobFactory(jobFactory); } }
@SuppressWarnings("unchecked") private Job saveExecutionAndCreateJob(JobExecution jobExecution) { String entityTypeId = jobExecution.getEntityType().getId(); dataService.add(entityTypeId, jobExecution); try { JobFactory jobFactory = jobFactoryRegistry.getJobFactory(jobExecution); return jobFactory.createJob(jobExecution); } catch (RuntimeException ex) { LOG.error("Error creating job for JobExecution.", ex); jobExecution.setStatus(JobExecution.Status.FAILED); dataService.update(entityTypeId, jobExecution); throw ex; } }