OPEN - issue BATCH-364: StepScope responsibilities can be assumed by Step (not ApplicationContext)

http://jira.springframework.org/browse/BATCH-364

Instead of lazy open, throw exception is stream is used before open().
This commit is contained in:
dsyer
2008-02-15 09:19:25 +00:00
parent ff0f6266a9
commit 711d0c6e92
15 changed files with 167 additions and 671 deletions

View File

@@ -14,6 +14,7 @@ import org.springframework.batch.execution.scope.StepContextAware;
import org.springframework.batch.item.ExecutionAttributes;
import org.springframework.batch.item.ItemStream;
import org.springframework.batch.item.KeyedItemReader;
import org.springframework.batch.item.exception.StreamException;
import org.springframework.batch.sample.item.writer.StagingItemWriter;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.jdbc.core.RowMapper;
@@ -127,7 +128,7 @@ public class StagingItemReader extends JdbcDaoSupport implements ItemStream, Key
private Long doRead() {
if (!initialized) {
open();
throw new StreamException("ItemStream must be open before it can be read.");
}
Long key = getBuffer().next();