RESOLVED - issue BATCH-565: StatefulRetryStepFactoryBean ignores skip configuration

Added additional protected getter so the skip policy can be determined from base class
This commit is contained in:
dsyer
2008-04-07 10:39:38 +00:00
parent cbd12f3fa0
commit b0ba064247
6 changed files with 87 additions and 11 deletions

View File

@@ -133,16 +133,16 @@ public class SimpleStepFactoryBean extends AbstractStepFactoryBean {
}
/**
* Public getter for the ItemProcessor.
* @return the itemProcessor
* Public getter for the ItemHandler.
* @return the ItemHandler
*/
protected ItemHandler getItemHandler() {
return itemHandler;
}
/**
* Public setter for the ItemProcessor.
* @param itemHandler the itemProcessor to set
* Public setter for the ItemHandler.
* @param itemHandler the ItemHandler to set
*/
protected void setItemHandler(ItemHandler itemHandler) {
this.itemHandler = itemHandler;

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.springframework.batch.core.step.skip.ItemSkipPolicy;
import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy;
import org.springframework.batch.core.step.skip.NeverSkipItemSkipPolicy;
import org.springframework.batch.core.step.skip.SkipLimitExceededException;
@@ -37,6 +38,8 @@ public class SkipLimitStepFactoryBean extends SimpleStepFactoryBean {
private int skipCacheCapacity = 1024;
private ItemSkipPolicy itemSkipPolicy;
/**
* Public setter for a limit that determines skip policy. If this value is
* positive then an exception in chunk processing will cause the item to be
@@ -96,6 +99,14 @@ public class SkipLimitStepFactoryBean extends SimpleStepFactoryBean {
protected ItemKeyGenerator getItemKeyGenerator() {
return itemKeyGenerator;
}
/**
* Protected getter for the {@link ItemSkipPolicy}.
* @return the itemSkipPolicy
*/
protected ItemSkipPolicy getItemSkipPolicy() {
return itemSkipPolicy;
}
/**
* Public setter for the capacity of the skipped item cache. If a large
@@ -134,9 +145,10 @@ public class SkipLimitStepFactoryBean extends SimpleStepFactoryBean {
addFatalExceptionIfMissing(SkipLimitExceededException.class);
List fatalExceptionList = Arrays.asList(fatalExceptionClasses);
LimitCheckingItemSkipPolicy skipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, Arrays
LimitCheckingItemSkipPolicy limitCheckingSkipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, Arrays
.asList(skippableExceptionClasses), fatalExceptionList);
itemHandler.setItemSkipPolicy(skipPolicy);
itemHandler.setItemSkipPolicy(limitCheckingSkipPolicy);
this.itemSkipPolicy = limitCheckingSkipPolicy;
SimpleLimitExceptionHandler exceptionHandler = new SimpleLimitExceptionHandler(skipLimit);
exceptionHandler.setExceptionClasses(skippableExceptionClasses);
exceptionHandler.setFatalExceptionClasses(fatalExceptionClasses);

View File

@@ -142,6 +142,7 @@ public class StatefulRetryStepFactoryBean extends SkipLimitStepFactoryBean {
StatefulRetryItemHandler itemHandler = new StatefulRetryItemHandler(getItemReader(), getItemWriter(),
retryTemplate, getItemKeyGenerator(), itemRecoverer);
itemHandler.setItemSkipPolicy(getItemSkipPolicy());
step.setItemHandler(itemHandler);