taskExecutor.execute(new Runnable() {
@Override
public void run() {
JsrJobContextFactoryBean factoryBean = null;
try {
factoryBean = (JsrJobContextFactoryBean) batchContext.getBean("&" + JSR_JOB_CONTEXT_BEAN_NAME);
factoryBean.setJobExecution(jobExecution);
final Job job = batchContext.getBean(Job.class);
if(!job.isRestartable()) {
throw new JobRestartException("Job " + jobName + " is not restartable");
}
semaphore.release();
// Initialization of the JobExecution for job level dependencies
jobRegistry.register(job, jobExecution);
job.execute(jobExecution);
jobRegistry.remove(jobExecution);
}
catch (Exception e) {
exceptionHolder.add(e);
} finally {
if(factoryBean != null) {
factoryBean.close();
}
batchContext.close();
if(semaphore.availablePermits() == 0) {