BATCH-2016: Added new flag to indicate if the step is being executed on

a restart.  If it is, the transition will be followed.  If not, we'll
look to see if we should be looking for somewhere else to restart.
This commit is contained in:
Michael Minella
2014-03-10 10:47:56 -05:00
parent e4b2a0bf7d
commit 3dc2ea3cb0
7 changed files with 154 additions and 46 deletions

View File

@@ -4,8 +4,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
@@ -54,7 +52,9 @@
</step>
<step id="step2">
<tasklet ref="decidingTasklet"/>
<!-- Second Run -->
<next on="ES3" to="step3"/>
<!-- First Run -->
<stop on="ES4" restart="step4"/>
</step>
<step id="step3" next="step4">
@@ -62,12 +62,12 @@
<chunk reader="step2ItemReader" writer="step2ItemWriter" commit-interval="10" />
</tasklet>
</step>
<step id="step4" next="completionDecider">
<step id="step4" next="completionDeciderStep">
<tasklet>
<chunk reader="step3ItemReader" writer="step3ItemWriter" commit-interval="10" />
</tasklet>
</step>
<decision decider="completionDecider" id="completionDecider">
<decision decider="completionDecider" id="completionDeciderStep">
<next on="CONTINUE" to="step3"/>
<end on="END"/>
</decision>

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
<job id="pattern.replay" xmlns="http://www.springframework.org/schema/batch">
<step id="pattern.replay.1" next="pattern.replay.2">
<tasklet ref="tasklet1" allow-start-if-complete="true"/>
</step>
<step id="pattern.replay.2" next="pattern.replay.3">
<tasklet ref="tasklet2" allow-start-if-complete="true"/>
</step>
<step id="pattern.replay.3">
<tasklet ref="tasklet3" allow-start-if-complete="true"/>
<stop on="*" restart="pattern.replay.1" />
<fail on="FAILED" />
</step>
</job>
<bean id="tasklet1" class="org.springframework.batch.core.step.RestartLoopTests$DefaultTasklet"/>
<bean id="tasklet2" class="org.springframework.batch.core.step.RestartLoopTests$DefaultTasklet"/>
<bean id="tasklet3" class="org.springframework.batch.core.step.RestartLoopTests$DefaultTasklet"/>
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean">
<property name="transactionManager" ref="transactionManager"/>
</bean>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository"/>
</bean>
</beans>