Add previously closed check around HibernateCusorItemReader#close()

This commit makes calling the close method on the
HibernateCursorItemReader safe to be called multiple times.

Resloves BATCH-2619
This commit is contained in:
Michael Minella
2017-05-25 09:41:49 -05:00
parent 7a1804b68d
commit 8f05c3e11e

View File

@@ -220,13 +220,14 @@ public class HibernateCursorItemReader<T> extends AbstractItemCountingItemStream
@Override
protected void doClose() throws Exception {
initialized = false;
if(initialized) {
if (cursor != null) {
cursor.close();
}
if (cursor != null) {
cursor.close();
helper.close();
}
helper.close();
initialized = false;
}
}