IN PROGRESS - issue BATCH-894: RFC: move ExitStatus up into Core?
Change Tasklet to use RepeatStatus instead of ExitStatus to signal continuable status
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package org.springframework.batch.test.sample;
|
||||
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.AttributeAccessor;
|
||||
import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
|
||||
@@ -11,16 +11,16 @@ public class SampleTasklet implements Tasklet {
|
||||
|
||||
@Autowired
|
||||
private SimpleJdbcTemplate jdbcTemplate;
|
||||
|
||||
private int id = 0;
|
||||
|
||||
|
||||
public SampleTasklet(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public ExitStatus execute(StepContribution contribution, AttributeAccessor attributes) throws Exception {
|
||||
public RepeatStatus execute(StepContribution contribution, AttributeAccessor attributes) throws Exception {
|
||||
System.err.println("SampleTasklet1.execute()");
|
||||
this.jdbcTemplate.update("insert into TESTS(ID, NAME) values (?, 'SampleTasklet" + id + "')", id);
|
||||
|
||||
return ExitStatus.FINISHED;
|
||||
return RepeatStatus.FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user