ExperimentalReadShardBalancer: close() exhausted iterators

Fixes a truly awful SAMReaders resource leak reported by Eric -- thanks Eric!
This commit is contained in:
David Roazen 2012-09-24 14:45:53 -04:00
parent 9fd30d6f1c
commit 0b488cce66
1 changed files with 4 additions and 0 deletions

View File

@ -89,6 +89,10 @@ public class ExperimentalReadShardBalancer extends ShardBalancer {
// If we've exhausted the current file pointer of reads, move to the next file pointer (if there is one):
if ( currentFilePointerReadsIterator != null && ! currentFilePointerReadsIterator.hasNext() ) {
// Close the old, exhausted chain of iterators to release resources
currentFilePointerReadsIterator.close();
do {
advanceFilePointer();
} while ( currentFilePointer != null && isEmpty(currentFilePointer.fileSpans) ); // skip empty file pointers