From e8a003584451ad097ffd95fdaa6a69c84b362cb5 Mon Sep 17 00:00:00 2001 From: Michael Minella Date: Thu, 20 Feb 2014 11:38:20 -0600 Subject: [PATCH] Fixed documentation to correctly use BatchStatus value instead of RepeatStatus value --- src/site/docbook/reference/step.xml | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/site/docbook/reference/step.xml b/src/site/docbook/reference/step.xml index 36a7708c4..b73710892 100644 --- a/src/site/docbook/reference/step.xml +++ b/src/site/docbook/reference/step.xml @@ -305,7 +305,7 @@ itemWriter.write(items); successful the first time. An example might be a validation step, or a Step that cleans up resources before processing. During normal processing of a restarted job, any step with - a status of 'FINISHED', meaning it has already been completed + a status of 'COMPLETED', meaning it has already been completed successfully, will be skipped. Setting allow-start-if-complete to "true" overrides this so that the step will always run: @@ -322,19 +322,19 @@ itemWriter.write(items); <job id="footballJob" restartable="true"> <step id="playerload" next="gameLoad"> <tasklet> - <chunk reader="playerFileItemReader" writer="playerWriter" + <chunk reader="playerFileItemReader" writer="playerWriter" commit-interval="10" /> </tasklet> </step> <step id="gameLoad" next="playerSummarization"> <tasklet allow-start-if-complete="true"> - <chunk reader="gameFileItemReader" writer="gameWriter" + <chunk reader="gameFileItemReader" writer="gameWriter" commit-interval="10"/> </tasklet> </step> <step id="playerSummarization"> <tasklet start-limit="3"> - <chunk reader="playerSummarizationSource" writer="summaryWriter" + <chunk reader="playerSummarizationSource" writer="summaryWriter" commit-interval="10"/> </tasklet> </step> @@ -453,7 +453,7 @@ itemWriter.write(items); records are logged as well, which will be covered later when discussing listeners.<step id="step1"> <tasklet> - <chunk reader="flatFileItemReader" writer="itemWriter" + <chunk reader="flatFileItemReader" writer="itemWriter" commit-interval="10" skip-limit="10"> <skippable-exception-classes> <include class="org.springframework.batch.item.file.FlatFileParseException"/> @@ -477,7 +477,7 @@ itemWriter.write(items); identify which exceptions should cause failure and skip everything else:<step id="step1"> <tasklet> - <chunk reader="flatFileItemReader" writer="itemWriter" + <chunk reader="flatFileItemReader" writer="itemWriter" commit-interval="10" skip-limit="10"> <skippable-exception-classes> <include class="java.lang.Exception"/> @@ -519,7 +519,7 @@ itemWriter.write(items); <step id="step1"> <tasklet> - <chunk reader="itemReader" writer="itemWriter" + <chunk reader="itemReader" writer="itemWriter" commit-interval="2" retry-limit="3"> <retryable-exception-classes> <include class="org.springframework.dao.DeadlockLoserDataAccessException"/> @@ -590,8 +590,8 @@ itemWriter.write(items); <step id="step1"> <tasklet> <chunk reader="itemReader" writer="itemWriter" commit-interval="2"/> - <transaction-attributes isolation="DEFAULT" - propagation="REQUIRED" + <transaction-attributes isolation="DEFAULT" + propagation="REQUIRED" timeout="30"/> </tasklet> </step> @@ -629,7 +629,7 @@ itemWriter.write(items); </tasklet> </step> -<beans:bean id="compositeWriter" +<beans:bean id="compositeWriter" class="org.springframework.batch.item.support.CompositeItemWriter"> <beans:property name="delegates"> <beans:list> @@ -791,11 +791,11 @@ itemWriter.write(items); be beneficial to log the skipped records, so that they can be deal with later. In the case of read errors, this can be done with an ItemReaderListener:public interface ItemReadListener<T> extends StepListener { - + void beforeRead(); void afterRead(T item); - + void onReadError(Exception ex); } @@ -1058,16 +1058,16 @@ itemWriter.write(items); private Resource directory; - public RepeatStatus execute(StepContribution contribution, + public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception { File dir = directory.getFile(); Assert.state(dir.isDirectory()); - + File[] files = dir.listFiles(); for (int i = 0; i < files.length; i++) { boolean deleted = files[i].delete(); if (!deleted) { - throw new UnexpectedJobExecutionException("Could not delete file " + + throw new UnexpectedJobExecutionException("Could not delete file " + files[i].getPath()); } } @@ -1095,10 +1095,10 @@ itemWriter.write(items); </step> </job> -<beans:bean id="fileDeletingTasklet" +<beans:bean id="fileDeletingTasklet" class="org.springframework.batch.sample.tasklet.FileDeletingTasklet"> <beans:property name="directoryResource"> - <beans:bean id="directory" + <beans:bean id="directory" class="org.springframework.core.io.FileSystemResource"> <beans:constructor-arg value="target/test-outputs/test-dir" /> </beans:bean> @@ -1237,7 +1237,7 @@ itemWriter.write(items); Step, if the Step's execution results in an ExitStatus that is not covered by an element, then the framework will throw an exception and - the Job will fail. The framework will + the Job will fail. The framework will automatically order transitions from most specific to least specific. This means that even if the elements were swapped for "stepA" in the example above, an ExitStatus of @@ -1312,7 +1312,7 @@ itemWriter.write(items); public ExitStatus afterStep(StepExecution stepExecution) { String exitCode = stepExecution.getExitStatus().getExitCode(); - if (!exitCode.equals(ExitStatus.FAILED.getExitCode()) && + if (!exitCode.equals(ExitStatus.FAILED.getExitCode()) && stepExecution.getSkipCount() > 0) { return new ExitStatus("COMPLETED WITH SKIPS"); } @@ -1497,7 +1497,7 @@ itemWriter.write(items); <job id="job"> <step id="step1" parent="s1" next="decision" /> - + <decision id="decision" decider="decider"> <next on="FAILED" to="step2" /> <next on="COMPLETED" to="step3" /> @@ -1592,7 +1592,7 @@ itemWriter.write(items); <job id="jobStepJob" restartable="true"> <step id="jobStepJob.step1"> - <job ref="job" job-launcher="jobLauncher" + <job ref="job" job-launcher="jobLauncher" job-parameters-extractor="jobParametersExtractor"/> </step> </job> @@ -1714,8 +1714,8 @@ itemWriter.write(items); scope must be added explicitly, either by using the batch namespace: - <beans xmlns="http://www.springframework.org/schema/beans" - xmlns:batch="http://www.springframework.org/schema/batch" + <beans xmlns="http://www.springframework.org/schema/beans" + xmlns:batch="http://www.springframework.org/schema/batch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="..."> <batch:job .../>