From 44630b5bfbe89ba198f0b8f3e9cdb346114c69da Mon Sep 17 00:00:00 2001 From: dhgarrette Date: Sun, 23 Aug 2009 19:02:19 +0000 Subject: [PATCH] BATCH-1381: Update docs for and in exception lists --- src/site/docbook/reference/step.xml | 44 +++++++++++++++-------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/site/docbook/reference/step.xml b/src/site/docbook/reference/step.xml index 30084921e..cd2b8d9fb 100644 --- a/src/site/docbook/reference/step.xml +++ b/src/site/docbook/reference/step.xml @@ -478,7 +478,7 @@ itemWriter.write(items); <chunk reader="flatFileItemReader" writer="itemWriter" commit-interval="10" skip-limit="10"> <skippable-exception-classes> - org.springframework.batch.item.file.FlatFileParseException + <include class="org.springframework.batch.item.file.FlatFileParseException"/> </skippable-exception-classes> </chunk> </tasklet> @@ -489,11 +489,8 @@ itemWriter.write(items); FlatFileParseException is thrown, it will be skipped and counted against the total skip limit of 10. Separate counts are made of skips on read, process and write inside the step execution, - and the limit applies across all. - - -
- Configuring Fatal Exceptions + and the limit applies across all. Once the skip limit is reached, the + next exception found will cause the step to fail. One problem with the example above is that any other exception besides a FlatFileParseException will cause the @@ -505,20 +502,27 @@ itemWriter.write(items); <chunk reader="flatFileItemReader" writer="itemWriter" commit-interval="10" skip-limit="10"> <skippable-exception-classes> - java.lang.Exception + <include class="java.lang.Exception"/> + <exclude class="java.io.FileNotFoundException"/> </skippable-exception-classes> - <fatal-exception-classes> - java.io.FileNotFoundException - </fatal-exception-classes> </chunk> </tasklet> </step> - By setting the skippable exceptions to - java.lang.Exception, any exception that is thrown - will be skipped. However, the second list, 'fatal-exception-classes', - contains specific exceptions that should be fatal if encountered (i.e. - not skipped). + By 'including' java.lang.Exception as a + skippable exception class, the configuration indicates that all + Exceptions are skippable. However, by 'excluding' + java.io.FileNotFoundException, the configuration + refines the list of skippable exception classes to be all + Exceptions except + FileNotFoundException. Any excluded exception + calsses will be fatal if encountered (i.e. not skipped). + + For any exception encountered, the skippability will be determined + by the nearest superclass in the class hierarchy. Any unclassifed + exception will be treated as 'fatal'. The order of the + <include/> and <exclude/> elements + does not matter.
@@ -540,7 +544,7 @@ itemWriter.write(items); <chunk reader="itemReader" writer="itemWriter" commit-interval="2" retry-limit="3"> <retryable-exception-classes> - org.springframework.dao.DeadlockLoserDataAccessException + <include class="org.springframework.dao.DeadlockLoserDataAccessException"/> </retryable-exception-classes> </chunk> </tasklet> @@ -549,7 +553,7 @@ itemWriter.write(items); The Step allows a limit for the number of times an individual item can be retried, and a list of exceptions that are 'retryable'. More details on how retry works can be found in + linkend="retry" />.
@@ -564,15 +568,13 @@ itemWriter.write(items); ItemWriter should not cause a rollback because no action has taken place to invalidate the transaction. For this reason, the Step can be configured with a list of - exceptions that should not cause rollback. The - no-rollback-exception-classes element is a list of transaction - attributes, separated by commas or newlines. + exceptions that should not cause rollback. <step id="step1"> <tasklet> <chunk reader="itemReader" writer="itemWriter" commit-interval="2"/> <no-rollback-exception-classes> - org.springframework.batch.item.validator.ValidationException + <include class="org.springframework.batch.item.validator.ValidationException"/> </no-rollback-exception-classes> </tasklet> </step>