diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java index 7789571a9..cbfe8d72c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/HibernateCursorItemReader.java @@ -235,7 +235,7 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl /* (non-Javadoc) * @see org.springframework.batch.item.stream.ItemStreamAdapter#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { lastCommitRowNumber = currentProcessedRow; if (!useStatelessSession) { statefulSession.clear(); @@ -245,7 +245,7 @@ public class HibernateCursorItemReader extends AbstractItemStreamItemReader impl /* (non-Javadoc) * @see org.springframework.batch.item.stream.ItemStreamAdapter#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { currentProcessedRow = lastCommitRowNumber; if (lastCommitRowNumber == 0) { cursor.beforeFirst(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java index fcba0cf21..118a3577e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/cursor/JdbcCursorItemReader.java @@ -232,7 +232,7 @@ public class JdbcCursorItemReader extends AbstractTransactionalIoSource implemen * Mark the current row. Calling reset will cause the result set to be set * to the current row when mark was called. */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { lastCommittedRow = currentProcessedRow; skippedRows.clear(); } @@ -242,7 +242,7 @@ public class JdbcCursorItemReader extends AbstractTransactionalIoSource implemen * * @throws DataAccessException */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { try { currentProcessedRow = lastCommittedRow; if (currentProcessedRow > 0) { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java index a7844c068..12b36084c 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/driving/DrivingQueryItemReader.java @@ -207,11 +207,11 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource } protected void transactionCommitted() { - mark(null); + mark(); } protected void transactionRolledBack() { - reset(null); + reset(); } /** @@ -237,14 +237,14 @@ public class DrivingQueryItemReader extends AbstractTransactionalIoSource /* (non-Javadoc) * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { lastCommitIndex = currentIndex; } /* (non-Javadoc) * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { keysIterator = keys.listIterator(lastCommitIndex); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java index 5ffcdbae2..0c165134e 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java @@ -53,7 +53,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen */ public void open() { super.open(); - mark(null); + mark(); } /** @@ -81,7 +81,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen record = readLine(); } - mark(data); + mark(); } @@ -115,14 +115,14 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { getReader().mark(); } /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { getReader().reset(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java index 7a8a31e07..1832a7002 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java @@ -118,14 +118,14 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements * Commit the transaction. */ protected void transactionCommitted() { - mark(null); + mark(); } /** * Rollback the transaction. */ protected void transactionRolledBack() { - reset(null); + reset(); } // This method removes any information in the file before this reset point. @@ -552,14 +552,14 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements /* (non-Javadoc) * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { getOutputState().mark(); } /* (non-Javadoc) * @see org.springframework.batch.io.support.AbstractTransactionalIoSource#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { getOutputState().checkFileSize(); resetPositionForRestart(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java index d25fdecde..67f9836f9 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/support/AbstractTransactionalIoSource.java @@ -17,7 +17,6 @@ package org.springframework.batch.io.support; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; -import org.springframework.batch.item.ExecutionAttributes; import org.springframework.batch.item.stream.ItemStreamAdapter; /** @@ -39,14 +38,14 @@ public abstract class AbstractTransactionalIoSource extends ItemStreamAdapter { * * @see TransactionSynchronization#afterCompletion */ - public abstract void mark(ExecutionAttributes executionAttributes); + public abstract void mark(); /* * Called when a transaction has been rolled back. * * @see TransactionSynchronization#afterCompletion */ - public abstract void reset(ExecutionAttributes executionAttributes); + public abstract void reset(); /* (non-Javadoc) * @see org.springframework.batch.item.stream.ItemStreamAdapter#isMarkSupported() diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java index 6e3ae3fde..b57b33b22 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java @@ -124,7 +124,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade throw new DataAccessResourceFailureException("Unable to get input stream", ioe); } initialized = true; - mark(null); + mark(); } public void setResource(Resource resource) { @@ -210,7 +210,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade fragmentReader.next(); moveCursorToNextFragment(fragmentReader); } - mark(null); // reset the history buffer + mark(); // reset the history buffer } /** @@ -266,7 +266,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { lastCommitPointRecordCount = currentRecordCount; txReader.onCommit(); skipRecords = new ArrayList(); @@ -275,7 +275,7 @@ public class StaxEventItemReader extends AbstractItemReader implements ItemReade /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { currentRecordCount = lastCommitPointRecordCount; txReader.onRollback(); fragmentReader.reset(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java index d6c397242..b1adddc65 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java @@ -450,7 +450,7 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { lastCommitPointPosition = getPosition(); lastCommitPointRecordCount = currentRecordCount; } @@ -458,7 +458,7 @@ public class StaxEventItemWriter implements ItemWriter, ItemStream, Initializing /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { currentRecordCount = lastCommitPointRecordCount; // close output close(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java index 149ae6f75..2436cc2e0 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemStream.java @@ -25,10 +25,10 @@ package org.springframework.batch.item; *

* The state that is stored is represented as {@link ExecutionAttributes} which * enforces a requirement that any restart data can be represented by a - * Properties object. In general, the contract is that {@link ExecutionAttributes} - * that is returned via the {@link #getExecutionAttributes()} method will be given - * back to the {@link #restoreFrom(ExecutionAttributes)} method, exactly as it was - * provided. + * Properties object. In general, the contract is that + * {@link ExecutionAttributes} that is returned via the + * {@link #getExecutionAttributes()} method will be given back to the + * {@link #restoreFrom(ExecutionAttributes)} method, exactly as it was provided. *

* * @author Dave Syer @@ -57,7 +57,14 @@ public interface ItemStream extends ExecutionAttributesProvider { void close() throws StreamException; /** - * Clients are expected to check this flag before calling mark or reset. + * Clients are expected to check this flag before calling mark or reset.
+ * + * Implementations should also document explicitly, if mark is supported, + * how it will behave in a multi-threaded environment. Generally, if the + * stream is being accessed from multiple threads concurrently, it will have + * to manage that internally, and also reflect only the completed marks + * (independent of the order they happen) when + * {@link ExecutionAttributesProvider#getExecutionAttributes()} is called. * * @return true if mark and reset are supported by the {@link ItemStream} */ @@ -65,24 +72,25 @@ public interface ItemStream extends ExecutionAttributesProvider { /** * Mark the stream so that it can be reset later and the items backed out. - * Implementations may use the information in the provided context to make - * calculations that account for things like multiple open cursors. The - * context should also be updated with any information of this nature that - * might be needed by a reset or by future calls to mark. + * After this method is called the result will be reflected in subsequent + * calls to {@link ExecutionAttributesProvider#getExecutionAttributes()}.
* - * @param the context which might contain information needed to determine - * what action to take, and into which the current mark information can go. + * In a multi-threaded setting implementations have to ensure that only the + * state from the current thread is saved. * * @throws UnsupportedOperationException if the operation is not supported */ - void mark(ExecutionAttributes executionAttributes); + void mark(); /** * Reset the stream to the last mark. After a reset the stream state will be * such that changes (items read or written) since the last call to mark - * with the same context will not be visible after a call to close. + * will not be visible after a call to close.
+ * + * In a multi-threaded setting implementations have to ensure that only the + * state from the current thread is reset. * * @throws UnsupportedOperationException if the operation is not supported */ - void reset(ExecutionAttributes executionAttributes); + void reset(); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java index 80887c2d9..92f535a14 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/reader/DelegatingItemReader.java @@ -119,18 +119,18 @@ public class DelegatingItemReader extends AbstractItemReader implements Skippabl /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { if (inputSource instanceof ItemStream) { - ((ItemStream) inputSource).mark(executionAttributes); + ((ItemStream) inputSource).mark(); } } /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { if (inputSource instanceof ItemStream) { - ((ItemStream) inputSource).reset(executionAttributes); + ((ItemStream) inputSource).reset(); } } } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java index 02034fb40..67bbb4da2 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/ItemStreamAdapter.java @@ -64,14 +64,14 @@ public class ItemStreamAdapter implements ItemStream { /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.ExecutionAttributes) */ - public void mark(ExecutionAttributes executionAttributes) { + public void mark() { throw new UnsupportedOperationException("Mark operation not supported."); } /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.ExecutionAttributes) */ - public void reset(ExecutionAttributes executionAttributes) { + public void reset() { throw new UnsupportedOperationException("Reset operation not supported."); } diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java index 875d3b63f..0f6220183 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/stream/SimpleStreamManager.java @@ -177,7 +177,7 @@ public class SimpleStreamManager implements StreamManager { iterate(key, new Callback() { public void execute(ItemStream stream) { if (stream.isMarkSupported()) { - stream.mark(stream.getExecutionAttributes()); + stream.mark(); } } }); @@ -186,7 +186,7 @@ public class SimpleStreamManager implements StreamManager { iterate(key, new Callback() { public void execute(ItemStream stream) { if (stream.isMarkSupported()) { - stream.reset(stream.getExecutionAttributes()); + stream.reset(); } } }); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java index 058155c40..3d9e11ee1 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/DrivingQueryItemReaderTests.java @@ -147,11 +147,11 @@ public class DrivingQueryItemReaderTests extends TestCase { private void commit() { - ((ItemStream) source).mark(null); + ((ItemStream) source).mark(); } private void rollback() { - ((ItemStream) source).reset(null); + ((ItemStream) source).reset(); } private InitializingBean getAsInitializingBean(ItemReader source) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java index e3719a834..c381779ba 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/driving/FooInputSource.java @@ -63,14 +63,14 @@ class FooItemReader extends AbstractItemReader implements ItemStream, ItemReader /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#mark(org.springframework.batch.item.StreamContext) */ - public void mark(ExecutionAttributes streamContext) { - inputSource.mark(streamContext); + public void mark() { + inputSource.mark(); } /* (non-Javadoc) * @see org.springframework.batch.item.ItemStream#reset(org.springframework.batch.item.StreamContext) */ - public void reset(ExecutionAttributes streamContext) { - inputSource.reset(streamContext); + public void reset() { + inputSource.reset(); }; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java index ed559c95c..9bbb56c75 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java @@ -97,13 +97,13 @@ public class DefaultFlatFileItemReaderTests extends TestCase { inputSource.read(); // #1 inputSource.read(); // #2 // commit them - inputSource.mark(null); + inputSource.mark(); // read next record inputSource.read(); // # 3 // mark record as skipped inputSource.skip(); // read next records - inputSource.reset(null); + inputSource.reset(); // we should now process all records after first commit point, that are // not marked as skipped @@ -135,7 +135,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { // mark record as skipped inputSource.skip(); // rollback - inputSource.reset(null); + inputSource.reset(); // read next record inputSource.read(); // should be #1 @@ -173,7 +173,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { inputSource.read(); inputSource.read(); // commit them - inputSource.mark(null); + inputSource.mark(); // read next two records inputSource.read(); inputSource.read(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java index 42374f9e5..53d7ef354 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java @@ -370,11 +370,11 @@ public class FlatFileItemWriterTests extends TestCase { } private void commit() { - ((ItemStream) inputSource).mark(null); + ((ItemStream) inputSource).mark(); } private void rollback() { - ((ItemStream) inputSource).reset(null); + ((ItemStream) inputSource).reset(); } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java index 85f042476..aa6acd92f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/sql/AbstractJdbcItemReaderIntegrationTests.java @@ -150,11 +150,11 @@ public abstract class AbstractJdbcItemReaderIntegrationTests extends AbstractTra private void commit() { - ((ItemStream) source).mark(null); + ((ItemStream) source).mark(); } private void rollback() { - ((ItemStream) source).reset(null); + ((ItemStream) source).reset(); } private ItemStream getAsRestartable(ItemReader source) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java index d9c5c2114..f06e3279d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractDataSourceItemReaderIntegrationTests.java @@ -221,11 +221,11 @@ public abstract class AbstractDataSourceItemReaderIntegrationTests extends Abstr } private void commit() { - ((ItemStream) source).mark(((ItemStream) source).getExecutionAttributes()); + ((ItemStream) source).mark(); } private void rollback() { - ((ItemStream) source).reset(((ItemStream) source).getExecutionAttributes()); + ((ItemStream) source).reset(); } private Skippable getAsSkippable(ItemReader source) { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java index 5af734097..b2c9e5bbe 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/support/AbstractTransactionalIoSourceTests.java @@ -18,7 +18,6 @@ package org.springframework.batch.io.support; import junit.framework.TestCase; -import org.springframework.batch.item.ExecutionAttributes; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.util.Assert; @@ -41,13 +40,13 @@ public class AbstractTransactionalIoSourceTests extends TestCase { } public void testCommit(){ - source.mark(null); + source.mark(); assertTrue(source.commitCalled); assertFalse(source.rollbackCalled); } public void testRollback(){ - source.reset(null); + source.reset(); assertFalse(source.commitCalled); assertTrue(source.rollbackCalled); } @@ -57,12 +56,12 @@ public class AbstractTransactionalIoSourceTests extends TestCase { private boolean commitCalled = false; private boolean rollbackCalled = false; - public void mark(ExecutionAttributes streamContext) { + public void mark() { Assert.isTrue(!commitCalled, "Commit aleady called"); commitCalled = true; } - public void reset(ExecutionAttributes streamContext) { + public void reset() { Assert.isTrue(!rollbackCalled, "Rollback aleady called"); rollbackCalled = true; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java index 806e83c60..4f596346d 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventItemReaderTests.java @@ -156,7 +156,7 @@ public class StaxEventItemReaderTests extends TestCase { source.skip(); List second = (List) source.read(); assertFalse(first.equals(second)); - source.reset(null); + source.reset(); assertEquals(second, source.read()); } @@ -168,21 +168,21 @@ public class StaxEventItemReaderTests extends TestCase { // rollback between deserializing records List first = (List) source.read(); - source.mark(null); + source.mark(); List second = (List) source.read(); assertFalse(first.equals(second)); - source.reset(null); + source.reset(); assertEquals(second, source.read()); // rollback while deserializing record - source.reset(null); + source.reset(); source.setFragmentDeserializer(new ExceptionFragmentDeserializer()); try { source.read(); } catch (Exception expected) { - source.reset(null); + source.reset(); } source.setFragmentDeserializer(deserializer); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java index 6f66513c9..a870b552c 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java @@ -67,7 +67,7 @@ public class StaxEventWriterItemWriterTests extends TestCase { public void testRollback() throws Exception { writer.write(record); // rollback - writer.reset(null); + writer.reset(); assertEquals("", outputFileContent()); } @@ -77,7 +77,7 @@ public class StaxEventWriterItemWriterTests extends TestCase { public void testCommit() throws Exception { writer.write(record); // commit - writer.mark(null); + writer.mark(); assertTrue(outputFileContent().contains(TEST_STRING)); } @@ -87,7 +87,7 @@ public class StaxEventWriterItemWriterTests extends TestCase { public void testRestart() throws Exception { // write records writer.write(record); - writer.mark(null); + writer.mark(); ExecutionAttributes streamContext = writer.getExecutionAttributes(); // create new writer from saved restart data and continue writing @@ -131,7 +131,7 @@ public class StaxEventWriterItemWriterTests extends TestCase { put("attribute", "value"); }}); writer.open(); - writer.mark(null); + writer.mark(); assertTrue(outputFileContent().indexOf("