OPEN - issue BATCH-789: Remove mark/reset from ItemReader

Shift chunk iteration into StepHandler - had to sacrifice interrupted check inside chunk
This commit is contained in:
dsyer
2008-08-20 15:24:05 +00:00
parent dbc24626f3
commit ef4f2900cc
19 changed files with 524 additions and 637 deletions

View File

@@ -7,9 +7,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.item.ClearFailedException;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.item.FlushFailedException;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.ItemStreamException;
import org.springframework.batch.item.ItemWriter;
@@ -78,20 +76,6 @@ public class ChunkMessageChannelItemWriter<T> extends StepExecutionListenerSuppo
}
/**
* No-op.
* @see org.springframework.batch.item.ItemWriter#flush()
*/
public void flush() throws FlushFailedException {
}
/**
* No-op.
* @see org.springframework.batch.item.ItemWriter#clear()
*/
public void clear() throws ClearFailedException {
}
@Override
public void beforeStep(StepExecution stepExecution) {
localState.setStepExecution(stepExecution);
@@ -169,6 +153,7 @@ public class ChunkMessageChannelItemWriter<T> extends StepExecutionListenerSuppo
Assert.state(jobInstanceId.equals(localState.getJobId()), "Message contained wrong job instance id ["
+ jobInstanceId + "] should have been [" + localState.getJobId() + "].");
localState.actual++;
// TODO: apply the skip count
ExitStatus result = payload.getExitStatus();
// TODO: check it can never be ExitStatus.FINISHED?
if (!result.isContinuable()) {

View File

@@ -53,7 +53,7 @@ public class ChunkMessageItemWriterIntegrationTests {
@Qualifier("replies")
private PollableChannel replies;
private SimpleStepFactoryBean<Object,Object> factory;
private SimpleStepFactoryBean<Object,Object> factory = new SimpleStepFactoryBean<Object,Object>();
private SimpleJobRepository jobRepository;
@@ -63,7 +63,6 @@ public class ChunkMessageItemWriterIntegrationTests {
@Before
public void setUp() {
factory = new SimpleStepFactoryBean<Object,Object>();
jobRepository = new SimpleJobRepository(new MapJobInstanceDao(),
new MapJobExecutionDao(), new MapStepExecutionDao(), new MapExecutionContextDao());
factory.setJobRepository(jobRepository);

View File

@@ -53,10 +53,6 @@ public class MessageChannelItemWriterTests {
assertEquals(Required.class, annotations[0].annotationType());
}
/**
* Test method for {@link org.springframework.batch.integration.item.MessageChannelItemWriter#write(java.lang.Object)}.
* @throws Exception
*/
@Test
public void testWrite() throws Exception {
DirectChannel channel = new DirectChannel();
@@ -70,10 +66,6 @@ public class MessageChannelItemWriterTests {
assertEquals("foo", message.getPayload());
}
/**
* Test method for {@link org.springframework.batch.integration.item.MessageChannelItemWriter#write(java.lang.Object)}.
* @throws Exception
*/
@Test
public void testWriteWithRollback() throws Exception {
DirectChannel channel = new DirectChannel();
@@ -93,10 +85,6 @@ public class MessageChannelItemWriterTests {
}
}
/**
* Test method for {@link org.springframework.batch.integration.item.MessageChannelItemWriter#write(java.lang.Object)}.
* @throws Exception
*/
@Test
public void testWriteWithRollbackOnEndpoint() throws Exception {
DirectChannel channel = new DirectChannel();

View File

@@ -39,7 +39,6 @@ import org.springframework.integration.channel.ThreadLocalChannel;
import org.springframework.integration.message.BlockingSource;
import org.springframework.integration.message.GenericMessage;
import org.springframework.integration.message.Message;
import org.springframework.integration.message.MessageSource;
import org.springframework.integration.message.MessageTarget;
import org.springframework.util.ReflectionUtils;
@@ -85,10 +84,6 @@ public class MessageOrientedStepTests {
assertEquals(Required.class, annotations[0].annotationType());
}
/**
* Test method for
* {@link org.springframework.batch.integration.job.MessageOrientedStep#setSource(MessageSource)}.
*/
@Test
public void testSetReplyChannel() {
Method method = ReflectionUtils.findMethod(MessageOrientedStep.class, "setSource",