RESOLVED - issue BATCH-268: retry configuration for ItemOrientedTasklet

http://jira.springframework.org/browse/BATCH-268

The retry only works if you have an ItemStream as an ItemReader (so that you get a proper rollback).  Applied the patch and fixed it up to fit the new m5 way of looking at things.
This commit is contained in:
dsyer
2008-02-11 17:23:57 +00:00
parent 0824f1aeb3
commit 2ce3013ac1
21 changed files with 338 additions and 14 deletions

View File

@@ -27,6 +27,7 @@ import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.stream.SimpleStreamManager;
import org.springframework.batch.item.stream.StreamManager;
import org.springframework.batch.repeat.exception.handler.ExceptionHandler;
import org.springframework.batch.retry.RetryPolicy;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.util.Assert;
@@ -42,6 +43,8 @@ public abstract class AbstractStep extends StepSupport implements InitializingBe
private int skipLimit = 0;
private ExceptionHandler exceptionHandler;
private RetryPolicy retryPolicy;
private JobRepository jobRepository;
@@ -71,6 +74,22 @@ public abstract class AbstractStep extends StepSupport implements InitializingBe
super(name);
}
/**
* Public getter for the {@link RetryPolicy}.
* @return the {@link RetryPolicy}
*/
public RetryPolicy getRetryPolicy() {
return retryPolicy;
}
/**
* Public setter for the {@link RetryPolicy}.
* @param retryPolicy the {@link RetryPolicy} to set
*/
public void setRetryPolicy(RetryPolicy retryPolicy) {
this.retryPolicy = retryPolicy;
}
public ExceptionHandler getExceptionHandler() {
return exceptionHandler;
}
@@ -177,6 +196,7 @@ public abstract class AbstractStep extends StepSupport implements InitializingBe
executor.setItemWriter(itemWriter);
executor.setItemRecoverer(itemRecoverer);
executor.setRepository(jobRepository);
executor.setRetryPolicy(retryPolicy);
executor.setStreamManager(manager);
try {
executor.afterPropertiesSet();

View File

@@ -315,9 +315,6 @@ public class SimpleStepExecutor implements InitializingBean {
try {
/*
* New transaction obtained, resynchronize TransactionSynchronization objects
*/
result = processChunk(step, contribution);
// TODO: check that stepExecution can