diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleStepFactoryBean.java index 590743786..9593ace36 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SimpleStepFactoryBean.java @@ -481,7 +481,7 @@ public class SimpleStepFactoryBean implements FactoryBean, BeanNameAware { step.setStepOperations(stepOperations); - step.setItemHandler(new ItemOrientedStepHandler(itemReader, itemProcessor, itemWriter, chunkOperations)); + step.setStepHandler(new ItemOrientedStepHandler(itemReader, itemProcessor, itemWriter, chunkOperations)); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java index 1a3c96879..b114ff0b0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBean.java @@ -278,7 +278,7 @@ public class SkipLimitStepFactoryBean extends SimpleStepFactoryBean writeSkipPolicy); itemHandler.setSkipListeners(BatchListenerFactoryHelper.getSkipListeners(getListeners())); - step.setItemHandler(itemHandler); + step.setStepHandler(itemHandler); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepHandlerStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepHandlerStep.java index ef979fe93..a68865eae 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepHandlerStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/item/StepHandlerStep.java @@ -108,7 +108,7 @@ public class StepHandlerStep extends AbstractStep { * * @param itemHandler the {@link StepHandler} to set */ - public void setItemHandler(StepHandler itemHandler) { + public void setStepHandler(StepHandler itemHandler) { this.itemHandler = itemHandler; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java index 2ee359c3f..50053c49e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/SkipLimitStepFactoryBeanTests.java @@ -27,10 +27,8 @@ import org.springframework.batch.core.step.skip.SkipLimitExceededException; import org.springframework.batch.core.step.skip.SkipListenerFailedException; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; -import org.springframework.batch.item.MarkFailedException; import org.springframework.batch.item.NoWorkFoundException; import org.springframework.batch.item.ParseException; -import org.springframework.batch.item.ResetFailedException; import org.springframework.batch.item.UnexpectedInputException; import org.springframework.batch.item.support.ListItemReader; import org.springframework.batch.support.transaction.ResourcelessTransactionManager; @@ -431,12 +429,6 @@ public class SkipLimitStepFactoryBeanTests { return item; } - public void mark() throws MarkFailedException { - } - - public void reset() throws ResetFailedException { - } - } /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java index aee9aa87f..a256bba6b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepExecutorInterruptionTests.java @@ -78,7 +78,7 @@ public class StepExecutorInterruptionTests extends TestCase { RepeatTemplate template = new RepeatTemplate(); // N.B, If we don't set the completion policy it might run forever template.setCompletionPolicy(new SimpleCompletionPolicy(2)); - step.setItemHandler(new SimpleStepHandler(new ItemReader() { + step.setStepHandler(new SimpleStepHandler(new ItemReader() { public Object read() throws Exception { // do something non-trivial (and not Thread.sleep()) double foo = 1; @@ -115,7 +115,7 @@ public class StepExecutorInterruptionTests extends TestCase { Thread processingThread = createThread(stepExecution); - step.setItemHandler(new SimpleStepHandler(new ItemReader() { + step.setStepHandler(new SimpleStepHandler(new ItemReader() { public Object read() throws Exception { return null; } @@ -152,7 +152,7 @@ public class StepExecutorInterruptionTests extends TestCase { public void testLockNotReleasedIfChunkFails() throws Exception { - step.setItemHandler(new SimpleStepHandler(new ItemReader() { + step.setStepHandler(new SimpleStepHandler(new ItemReader() { public Object read() throws Exception { throw new RuntimeException("Planned!"); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepIntegrationTests.java index 135283fec..eceb66e59 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepIntegrationTests.java @@ -111,7 +111,7 @@ public class StepHandlerStepIntegrationTests { @Test public void testStatusForCommitFailedException() throws Exception { - step.setItemHandler(new SimpleStepHandler(getReader(new String[] { "a", "b", "c" }), + step.setStepHandler(new SimpleStepHandler(getReader(new String[] { "a", "b", "c" }), new ItemWriter() { public void write(List data) throws Exception { TransactionSynchronizationManager diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepTests.java index 84ac7a402..d456562e8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/item/StepHandlerStepTests.java @@ -48,8 +48,6 @@ import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ItemStreamSupport; import org.springframework.batch.item.ItemWriter; -import org.springframework.batch.item.MarkFailedException; -import org.springframework.batch.item.ResetFailedException; import org.springframework.batch.item.support.ListItemReader; import org.springframework.batch.repeat.ExitStatus; import org.springframework.batch.repeat.policy.DefaultResultCompletionPolicy; @@ -95,7 +93,7 @@ public class StepHandlerStepTests extends TestCase { // Only process one item: RepeatTemplate template = new RepeatTemplate(); template.setCompletionPolicy(new SimpleCompletionPolicy(1)); - step.setItemHandler(new SimpleStepHandler(getReader(strings), itemWriter, template)); + step.setStepHandler(new SimpleStepHandler(getReader(strings), itemWriter, template)); step.setJobRepository(new JobRepositorySupport()); step.setTransactionManager(transactionManager); return step; @@ -199,7 +197,7 @@ public class StepHandlerStepTests extends TestCase { }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); @@ -223,7 +221,7 @@ public class StepHandlerStepTests extends TestCase { }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); @@ -247,7 +245,7 @@ public class StepHandlerStepTests extends TestCase { }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); step.registerStepExecutionListener(new StepExecutionListenerSupport() { public ExitStatus onErrorInStep(StepExecution stepExecution, Throwable e) { return ExitStatus.FAILED.addExitDescription("FOO"); @@ -273,7 +271,7 @@ public class StepHandlerStepTests extends TestCase { */ public void testNonRestartedJob() throws Exception { MockRestartableItemReader tasklet = new MockRestartableItemReader(); - step.setItemHandler(new SimpleStepHandler(tasklet, itemWriter)); + step.setStepHandler(new SimpleStepHandler(tasklet, itemWriter)); step.registerStream(tasklet); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); @@ -331,7 +329,7 @@ public class StepHandlerStepTests extends TestCase { */ public void testNoSaveExecutionAttributesRestartableJob() { MockRestartableItemReader tasklet = new MockRestartableItemReader(); - step.setItemHandler(new SimpleStepHandler(tasklet, itemWriter)); + step.setStepHandler(new SimpleStepHandler(tasklet, itemWriter)); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); @@ -351,7 +349,7 @@ public class StepHandlerStepTests extends TestCase { * Restartable. */ public void testRestartJobOnNonRestartableTasklet() throws Exception { - step.setItemHandler(new SimpleStepHandler(new ItemReader() { + step.setStepHandler(new SimpleStepHandler(new ItemReader() { public String read() throws Exception { return "foo"; } @@ -372,7 +370,7 @@ public class StepHandlerStepTests extends TestCase { executionContext.putString("foo", "bar"); } }; - step.setItemHandler(new SimpleStepHandler(reader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(reader, itemWriter)); step.registerStream(reader); JobExecution jobExecution = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -467,7 +465,7 @@ public class StepHandlerStepTests extends TestCase { return null; } }); - step.setItemHandler(new SimpleStepHandler(new MockRestartableItemReader() { + step.setStepHandler(new SimpleStepHandler(new MockRestartableItemReader() { public String read() throws Exception { throw new RuntimeException("FOO"); } @@ -494,7 +492,7 @@ public class StepHandlerStepTests extends TestCase { executionContext.putString("foo", "bar"); } }; - step.setItemHandler(new SimpleStepHandler(reader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(reader, itemWriter)); step.setStreams(new ItemStream[] { reader }); JobExecution jobExecution = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecution); @@ -528,7 +526,7 @@ public class StepHandlerStepTests extends TestCase { }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); @@ -555,7 +553,7 @@ public class StepHandlerStepTests extends TestCase { throw new RuntimeException("Foo"); } }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); @@ -582,7 +580,7 @@ public class StepHandlerStepTests extends TestCase { throw new Error("Foo"); } }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); JobExecution jobExecutionContext = new JobExecution(jobInstance); StepExecution stepExecution = new StepExecution(step.getName(), jobExecutionContext); @@ -609,11 +607,11 @@ public class StepHandlerStepTests extends TestCase { throw new RuntimeException("Foo"); } }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); step.setTransactionManager(new ResourcelessTransactionManager() { protected void doRollback(DefaultTransactionStatus status) throws TransactionException { // Simulate failure on rollback when stream resets - throw new ResetFailedException("Bar"); + throw new RuntimeException("Bar"); } }); @@ -703,7 +701,7 @@ public class StepHandlerStepTests extends TestCase { throw new RuntimeException("Bar"); } }; - step.setItemHandler(new SimpleStepHandler(itemReader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(itemReader, itemWriter)); step.registerStream(itemReader); JobExecution jobExecutionContext = new JobExecution(jobInstance); @@ -740,7 +738,7 @@ public class StepHandlerStepTests extends TestCase { throw new RuntimeException("CRASH!"); } }; - step.setItemHandler(new SimpleStepHandler(reader, itemWriter)); + step.setStepHandler(new SimpleStepHandler(reader, itemWriter)); step.registerStream(reader); StepExecution stepExecution = new StepExecution(step.getName(), new JobExecution(jobInstance)); @@ -858,12 +856,6 @@ public class StepHandlerStepTests extends TestCase { return restoreFromCalled; } - public void mark() throws MarkFailedException { - } - - public void reset() throws ResetFailedException { - } - public ExitStatus afterStep(StepExecution stepExecution) { return null; } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/MarkFailedException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/MarkFailedException.java deleted file mode 100644 index c7c58368a..000000000 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/MarkFailedException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.item; - -/** - * An exception class thrown when an {@link ItemReader} fails to mark its current state for future retry. - * - * @author Dave Syer - * @author Ben Hale - */ -public class MarkFailedException extends ItemReaderException { - - /** - * Create a new {@link MarkFailedException} based on a message. - * - * @param message the message for this exception - */ - public MarkFailedException(String message) { - super(message); - } - - /** - * Create a new {@link MarkFailedException} based on a message and another exception. - * - * @param msg the message for this exception - * @param nested the other exception - */ - public MarkFailedException(String msg, Throwable nested) { - super(msg, nested); - } - -} diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ResetFailedException.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ResetFailedException.java deleted file mode 100644 index eb39b4abb..000000000 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ResetFailedException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.item; - -/** - * An exception class thrown when an {@link ItemReader} fails to reset its state based on the previous mark. - * - * @author Dave Syer - * @author Ben Hale - */ -public class ResetFailedException extends ItemReaderException { - - /** - * Create a new {@link ResetFailedException} based on a message. - * - * @param message the message for this exception - */ - public ResetFailedException(String message) { - super(message); - } - - /** - * Create a new {@link ResetFailedException} based on a message and another exception. - * - * @param msg the message for this exception - * @param nested the other exception - */ - public ResetFailedException(String msg, Throwable nested) { - super(msg, nested); - } - -} diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java index 4e315e33b..a7835d8e3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/FlatFileItemWriter.java @@ -32,8 +32,6 @@ import org.springframework.batch.item.FlushFailedException; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemStreamException; import org.springframework.batch.item.ItemWriter; -import org.springframework.batch.item.MarkFailedException; -import org.springframework.batch.item.ResetFailedException; import org.springframework.batch.item.WriterNotOpenException; import org.springframework.batch.item.file.mapping.FieldSet; import org.springframework.batch.item.file.transform.LineAggregator; @@ -187,14 +185,12 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implement String line = lineAggregator.aggregate(item) + lineSeparator; try { state.write(line); - } catch (IOException e) { - throw new FlushFailedException( - "Could not write data. The file may be corrupt.", e); + } + catch (IOException e) { + throw new FlushFailedException("Could not write data. The file may be corrupt.", e); } } - state.mark(); - } /** @@ -240,8 +236,7 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implement } } catch (IOException e) { - throw new FlushFailedException( - "Could not write headers. The file may be corrupt.", e); + throw new FlushFailedException("Could not write headers. The file may be corrupt.", e); } } } @@ -395,18 +390,6 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implement fileChannel.position(lastMarkedByteOffsetPosition); } - /** - * Mark the current position. - */ - public void mark() { - try { - lastMarkedByteOffsetPosition = this.position(); - } - catch (IOException e) { - throw new MarkFailedException("Unable to get position for mark", e); - } - } - /** * Creates the buffered writer for the output file channel based on * configuration information. @@ -424,7 +407,8 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implement // in case of restarting reset position to last committed point if (restarted) { - this.reset(); + checkFileSize(); + truncate(); } initialized = true; @@ -450,43 +434,21 @@ public class FlatFileItemWriter extends ExecutionContextUserSupport implement } } - /** - * Resets the file writer's current position to the point stored in the - * last marked byte offset position variable. It first checks to make - * sure the current size of the file is not less than the byte position - * to be moved to (if it is, throws an environment exception), then it - * truncates the file to that reset position, and set the cursor to - * start writing at that point. - */ - public void reset() throws ResetFailedException { - checkFileSize(); - try { - getOutputState().truncate(); - } - catch (IOException e) { - throw new ResetFailedException("Unable to truncate file", e); - } - } - /** * Checks (on setState) to make sure that the current output file's size * is not smaller than the last saved commit point. If it is, then the * file has been damaged in some way and whole task must be started over * again from the beginning. + * @throws IOException if there is an IO problem */ - private void checkFileSize() { + private void checkFileSize() throws IOException { long size = -1; - try { - outputBufferedWriter.flush(); - size = fileChannel.size(); - } - catch (IOException e) { - throw new ResetFailedException("An Error occured while checking file size", e); - } + outputBufferedWriter.flush(); + size = fileChannel.size(); if (size < lastMarkedByteOffsetPosition) { - throw new ResetFailedException("Current file size is smaller than size at last commit"); + throw new ItemStreamException("Current file size is smaller than size at last commit"); } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/MarkFailedExceptionTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/MarkFailedExceptionTests.java deleted file mode 100644 index 427ec0967..000000000 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/MarkFailedExceptionTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.item; - -import org.springframework.batch.support.AbstractExceptionTests; - -public class MarkFailedExceptionTests extends AbstractExceptionTests { - - public Exception getException(String msg) throws Exception { - return new MarkFailedException(msg); - } - - public Exception getException(String msg, Throwable t) throws Exception { - return new MarkFailedException(msg, t); - } - -} diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ResetFailedExceptionTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ResetFailedExceptionTests.java deleted file mode 100644 index c0c05dcbc..000000000 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/ResetFailedExceptionTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.item; - -import org.springframework.batch.support.AbstractExceptionTests; - -public class ResetFailedExceptionTests extends AbstractExceptionTests { - - public Exception getException(String msg) throws Exception { - return new ResetFailedException(msg); - } - - public Exception getException(String msg, Throwable t) throws Exception { - return new ResetFailedException(msg, t); - } - -} diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java index bf3d64e22..25d818a80 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/GeneratingTradeItemReader.java @@ -3,8 +3,6 @@ package org.springframework.batch.sample.domain.trade.internal; import java.math.BigDecimal; import org.springframework.batch.item.ItemReader; -import org.springframework.batch.item.MarkFailedException; -import org.springframework.batch.item.ResetFailedException; import org.springframework.batch.sample.domain.trade.Trade; /** @@ -18,8 +16,6 @@ public class GeneratingTradeItemReader implements ItemReader { private int counter = 0; - private int marked; - public Trade read() throws Exception { if (counter < limit) { counter++; @@ -47,19 +43,5 @@ public class GeneratingTradeItemReader implements ItemReader { public int getLimit() { return limit; } - - /* (non-Javadoc) - * @see org.springframework.batch.item.ItemStream#mark() - */ - public void mark() throws MarkFailedException { - this.marked = this.counter; - } - - /* (non-Javadoc) - * @see org.springframework.batch.item.ItemStream#reset() - */ - public void reset() throws ResetFailedException { - this.counter = this.marked; - } }