RESOLVED - issue BATCH-486: Users must choose between skip and retry

Remove duplicate key generator property from factory beans.
This commit is contained in:
dsyer
2008-03-27 17:30:24 +00:00
parent e4c3048414
commit 9007a61f5e
2 changed files with 10 additions and 18 deletions

View File

@@ -78,6 +78,14 @@ public class SkipLimitStepFactoryBean extends SimpleStepFactoryBean {
public void setItemKeyGenerator(ItemKeyGenerator itemKeyGenerator) {
this.itemKeyGenerator = itemKeyGenerator;
}
/**
* Protected getter for the {@link ItemKeyGenerator}.
* @return the {@link ItemKeyGenerator}
*/
protected ItemKeyGenerator getItemKeyGenerator() {
return itemKeyGenerator;
}
/**
* Uses the {@link #skipLimit} value to configure item handler and and

View File

@@ -44,15 +44,13 @@ import org.springframework.batch.retry.support.RetryTemplate;
* handling policy. Only exhausted retries count against the exception handler,
* instead of counting all exceptions.<br/>
*
* This class is not designed for extension. Do not subclass it.
* This class is not designed for extension. Do not subclass it.
*
* @author Dave Syer
*
*/
public class StatefulRetryStepFactoryBean extends SkipLimitStepFactoryBean {
private ItemKeyGenerator itemKeyGenerator;
private ItemRecoverer itemRecoverer;
private int retryLimit;
@@ -96,20 +94,6 @@ public class StatefulRetryStepFactoryBean extends SkipLimitStepFactoryBean {
this.retryListeners = retryListeners;
}
/**
* Public setter for the {@link ItemKeyGenerator} which will be used to
* cache failed items between transactions. If it is not injected but the
* reader or writer implement {@link ItemKeyGenerator}, one of those will
* be used instead (preferring the reader to the writer if both would be
* appropriate). If neither can be used, then the default will be to just
* use the item itself as a cache key.
*
* @param itemKeyGenerator the {@link ItemKeyGenerator} to set
*/
public void setItemKeyGenerator(ItemKeyGenerator itemKeyGenerator) {
this.itemKeyGenerator = itemKeyGenerator;
}
/**
* Public setter for the {@link ItemRecoverer}. If this is set the
* {@link ItemRecoverer#recover(Object, Throwable)} will be called when
@@ -153,7 +137,7 @@ public class StatefulRetryStepFactoryBean extends SkipLimitStepFactoryBean {
}
StatefulRetryItemHandler itemHandler = new StatefulRetryItemHandler(getItemReader(), getItemWriter(),
retryTemplate, itemKeyGenerator, itemRecoverer);
retryTemplate, getItemKeyGenerator(), itemRecoverer);
step.setItemHandler(itemHandler);