diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java index c2239cc24..975eabd43 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java @@ -279,7 +279,7 @@ public class ItemOrientedStep extends AbstractStep implements InitializingBean { // only if chunk was successful stepExecution.apply(contribution); - streamManager.update(); + streamManager.update(stepExecution.getExecutionContext()); jobRepository.saveOrUpdate(stepExecution); } @@ -359,7 +359,7 @@ public class ItemOrientedStep extends AbstractStep implements InitializingBean { stepExecution.setEndTime(new Date(System.currentTimeMillis())); try { jobRepository.saveOrUpdate(stepExecution); - streamManager.close(); + streamManager.close(stepExecution.getExecutionContext()); } catch (Exception e) { logger diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java index 5b6ee0a4a..d2a1e49f3 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java @@ -378,16 +378,12 @@ public class ItemOrientedStepTests extends TestCase { assertEquals(false, stepExecution.getExecutionContext().containsKey("foo")); itemOrientedStep.setStreamManager(new SimpleStreamManager(new ResourcelessTransactionManager()) { - ExecutionContext executionContext; - public void update() { + public void update(ExecutionContext executionContext) { // TODO Auto-generated method stub executionContext.putString("foo", "bar"); } - public void open(ExecutionContext executionContext) throws StreamException { - this.executionContext = executionContext; - } }); itemOrientedStep.execute(stepExecution); @@ -416,7 +412,7 @@ public class ItemOrientedStepTests extends TestCase { return restoreFromCalledWithSomeContext; } - public void update() { + public void update(ExecutionContext executionContext) { getExecutionAttributesCalled = true; executionContext.putString("spam", "bucket"); } @@ -433,7 +429,7 @@ public class ItemOrientedStepTests extends TestCase { this.executionContext = executionContext; } - public void close() throws StreamException { + public void close(ExecutionContext executionContext) throws StreamException { } public void mark() throws MarkFailedException {