List of usage examples for org.springframework.batch.core JobInstance incrementVersion
public void incrementVersion()
From source file:org.trpr.platform.batch.impl.spring.admin.repository.MapJobInstanceDao.java
public JobInstance createJobInstance(String jobName, JobParameters jobParameters) { Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist"); JobInstance jobInstance = new JobInstance(currentId++, jobParameters, jobName); jobInstance.incrementVersion(); //Removes the older jobInstances if (this.jobInstances.size() >= maxJobInstanceCount) { JobInstance toRemove = this.jobInstances.remove(); LOGGER.info("Removing jobInstance: " + toRemove.toString()); List<JobExecution> executions = this.jobExecutionDao.findJobExecutions(toRemove); for (JobExecution execution : executions) { //Remove job executions LOGGER.info("Removing JobExecution: " + execution.toString()); this.jobExecutionDao.removeExecution(execution.getId()); this.stepExecutionDao.removeStepExecutions(execution); //Remove execution contexts this.executionContextDao.removeExecutionContext(execution); }//from ww w.j a v a2 s .com } jobInstances.add(jobInstance); return jobInstance; }