BATCH-402: Removed startLimit from Job. Also removed executionCount from JobExecution.
This commit is contained in:
@@ -41,8 +41,6 @@ public abstract class AbstractJob implements BeanNameAware, Job {
|
||||
|
||||
private boolean restartable = false;
|
||||
|
||||
private int startLimit = Integer.MAX_VALUE;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
@@ -109,17 +107,6 @@ public abstract class AbstractJob implements BeanNameAware, Job {
|
||||
this.steps.add(step);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.IJob#getStartLimit()
|
||||
*/
|
||||
public int getStartLimit() {
|
||||
return startLimit;
|
||||
}
|
||||
|
||||
public void setStartLimit(int startLimit) {
|
||||
this.startLimit = startLimit;
|
||||
}
|
||||
|
||||
public void setRestartable(boolean restartable) {
|
||||
this.restartable = restartable;
|
||||
}
|
||||
|
||||
@@ -158,10 +158,6 @@ public class SimpleJobRepository implements JobRepository {
|
||||
throw new JobRestartException("JobInstance already exists and is not restartable");
|
||||
}
|
||||
|
||||
jobInstance.setJobExecutionCount(jobExecutionDao.getJobExecutionCount(jobInstance));
|
||||
if (jobInstance.getJobExecutionCount() > job.getStartLimit()) {
|
||||
throw new JobRestartException("Restart Max exceeded for Job: " + jobInstance.toString());
|
||||
}
|
||||
List executions = jobExecutionDao.findJobExecutions(jobInstance);
|
||||
JobExecution lastExecution = null;
|
||||
// check for running executions and find the last started
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.batch.core.domain.JobParameters;
|
||||
import org.springframework.batch.core.domain.JobParametersBuilder;
|
||||
import org.springframework.batch.core.domain.Step;
|
||||
import org.springframework.batch.core.domain.StepExecution;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.batch.execution.job.JobSupport;
|
||||
import org.springframework.batch.execution.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.execution.repository.dao.JobInstanceDao;
|
||||
@@ -226,30 +225,6 @@ public class SimpleJobRepositoryTests extends TestCase {
|
||||
//// assertTrue(step.getStepExecutionCount() == 1);
|
||||
}
|
||||
|
||||
public void testRestartJobStartLimitExceeded() throws Exception {
|
||||
|
||||
jobConfiguration.setStartLimit(1);
|
||||
|
||||
jobInstanceDao.getJobInstance(jobConfiguration, jobParameters);
|
||||
jobInstanceDaoControl.setReturnValue(databaseJob);
|
||||
jobExecutionDao.getJobExecutionCount(databaseJob);
|
||||
// return a greater execution count then the start limit, should throw
|
||||
// exception
|
||||
jobExecutionDaoControl.setReturnValue(2);
|
||||
jobExecutionDaoControl.replay();
|
||||
jobInstanceDaoControl.replay();
|
||||
|
||||
try {
|
||||
jobRepository.createJobExecution(jobConfiguration, jobParameters);
|
||||
fail();
|
||||
}
|
||||
catch (JobRestartException ex) {
|
||||
// expected
|
||||
}
|
||||
|
||||
jobExecutionDaoControl.verify();
|
||||
}
|
||||
|
||||
public void testCreateNonRestartableJob() throws Exception {
|
||||
|
||||
// List jobs = new ArrayList();
|
||||
|
||||
Reference in New Issue
Block a user