diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/AbstractJob.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/AbstractJob.java index 6de446cb5..431382410 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/AbstractJob.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/AbstractJob.java @@ -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; } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java index 719281fc3..a25bc7ccf 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java @@ -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 diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java index 53854c7da..365de5e4b 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java @@ -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();