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 4705f0002..1413c805d 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 @@ -102,6 +102,7 @@ public class SimpleStreamManager implements StreamManager { ItemStream itemStream = (ItemStream) it.next(); itemStream.close(executionContext); } + streams.clear(); } } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java index 2caa859d5..fd4eb0437 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/stream/SimpleStreamManagerTests.java @@ -125,6 +125,22 @@ public class SimpleStreamManagerTests extends TestCase { assertEquals(1, list.size()); } + /** + * Test method for + * {@link org.springframework.batch.item.stream.SimpleStreamManager#commit(org.springframework.transaction.TransactionStatus)}. + */ + public void testCloseUnregisters() { + manager.register(new ItemStreamSupport() { + public void open(ExecutionContext executionContext) throws StreamException { + list.add("bar"); + } + }); + manager.open(null); + manager.close(null); + manager.open(null); + assertEquals(1, list.size()); + } + /** * Test method for * {@link org.springframework.batch.item.stream.SimpleStreamManager#commit(org.springframework.transaction.TransactionStatus)}. diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AsynchronousRepeatTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AsynchronousRepeatTests.java index 3d136984c..7b056676a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AsynchronousRepeatTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AsynchronousRepeatTests.java @@ -91,8 +91,8 @@ public class AsynchronousRepeatTests extends AbstractTradeBatchTests { // Shouldn't be necessary to wait: // Thread.sleep(500); assertEquals(NUMBER_OF_ITEMS, processor.count); - // Because of the throttling and queing internally to a TaskExecutor, - // more than one thread wil be used - the number used is (as of writing) + // Because of the throttling and queueing internally to a TaskExecutor, + // more than one thread will be used - the number used is (as of writing) // one less than the throttle limit of the template. // TODO: see if we can get it to use only one thread? assertTrue(threadNames.size() >= 1); diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java index bb5e6d7ca..c91d1d1cd 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/tasklet/SimpleTradeWriter.java @@ -51,8 +51,6 @@ public class SimpleTradeWriter extends AbstractItemWriter implements ItemStream */ private int tradeCount = 0; - private ExecutionContext executionContext; - /** * The input template is read using the readAndMap method, which accepts a * FieldSetMapper. This call returns a Trade object, which is then @@ -70,7 +68,6 @@ public class SimpleTradeWriter extends AbstractItemWriter implements ItemStream } public void open(ExecutionContext context) throws StreamException { - this.executionContext = context; } /* (non-Javadoc) diff --git a/spring-batch-samples/src/main/resources/jobs/footballJob.xml b/spring-batch-samples/src/main/resources/jobs/footballJob.xml index 3d1aaca3a..5bf0b75a9 100644 --- a/spring-batch-samples/src/main/resources/jobs/footballJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/footballJob.xml @@ -18,8 +18,6 @@ - - @@ -37,7 +35,6 @@ - @@ -50,7 +47,6 @@ - diff --git a/spring-batch-samples/src/main/resources/simple-container-definition.xml b/spring-batch-samples/src/main/resources/simple-container-definition.xml index 61f55281f..85303aad6 100644 --- a/spring-batch-samples/src/main/resources/simple-container-definition.xml +++ b/spring-batch-samples/src/main/resources/simple-container-definition.xml @@ -102,6 +102,7 @@ +