BATCH-365: ItemStream#Update and ItemStream#close now accept an ExecutionContext as an argument. I removed the local ExecutionContexts in the readers and readers, and had them use the passed in ones instead.

This commit is contained in:
lucasward
2008-02-26 21:22:54 +00:00
parent e952a55ab2
commit ed2bbf96e6
2 changed files with 5 additions and 9 deletions

View File

@@ -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

View File

@@ -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 {