Reset page and item count on RepositoryItemReader#close()

When closing the RepositoryItemReader, this commit now resets the
current item index and page index to be 0 so that it can be reused
imediately (instead of requiring the reader be step scoped for the reset
to occur).

BATCH-2365
This commit is contained in:
Michael Minella
2015-03-31 15:19:34 -05:00
parent 7c60b055c3
commit 84fc0c3f7c
2 changed files with 38 additions and 3 deletions

View File

@@ -216,6 +216,11 @@ public class RepositoryItemReader<T> extends AbstractItemCountingItemStreamItemR
@Override
protected void doClose() throws Exception {
synchronized (lock) {
current = 0;
page = 0;
results = null;
}
}
private Sort convertToSort(Map<String, Sort.Direction> sorts) {