Temporary fix: have RodLocusView manage and close its RODs. Really the
relationship between these two classes needs to be rethought; see JIRA GSA-207. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@1904 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
ad1fc511b1
commit
65b98470f3
|
|
@ -26,11 +26,6 @@ import java.util.Collections;
|
|||
* A view into the reference-ordered data in the provider.
|
||||
*/
|
||||
public class ManagingReferenceOrderedView implements ReferenceOrderedView {
|
||||
/**
|
||||
* The provider that's supplying our backing data.
|
||||
*/
|
||||
//private final ShardDataProvider provider;
|
||||
|
||||
/**
|
||||
* The data sources along with their current states.
|
||||
*/
|
||||
|
|
@ -41,7 +36,6 @@ public class ManagingReferenceOrderedView implements ReferenceOrderedView {
|
|||
* @param provider
|
||||
*/
|
||||
public ManagingReferenceOrderedView( ShardDataProvider provider ) {
|
||||
//this.provider = provider;
|
||||
for( ReferenceOrderedDataSource dataSource: provider.getReferenceOrderedData() )
|
||||
states.add( new ReferenceOrderedDataState( dataSource, (SeekableRODIterator)dataSource.seek(provider.getShard()) ) );
|
||||
|
||||
|
|
@ -72,17 +66,17 @@ public class ManagingReferenceOrderedView implements ReferenceOrderedView {
|
|||
// Clear out the existing data so that post-close() accesses to this data will fail-fast.
|
||||
states = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Models the traversal state of a given ROD lane.
|
||||
*/
|
||||
private class ReferenceOrderedDataState {
|
||||
public final ReferenceOrderedDataSource dataSource;
|
||||
public final SeekableRODIterator iterator;
|
||||
|
||||
public ReferenceOrderedDataState( ReferenceOrderedDataSource dataSource, SeekableRODIterator iterator ) {
|
||||
this.dataSource = dataSource;
|
||||
this.iterator = iterator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Models the traversal state of a given ROD lane.
|
||||
*/
|
||||
class ReferenceOrderedDataState {
|
||||
public final ReferenceOrderedDataSource dataSource;
|
||||
public final SeekableRODIterator iterator;
|
||||
|
||||
public ReferenceOrderedDataState( ReferenceOrderedDataSource dataSource, SeekableRODIterator iterator ) {
|
||||
this.dataSource = dataSource;
|
||||
this.iterator = iterator;
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,11 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
|
|||
// broken support for multi-locus rods
|
||||
//List<ReferenceOrderedDatum> multiLocusRODs = new LinkedList<ReferenceOrderedDatum>();
|
||||
|
||||
/**
|
||||
* The data sources along with their current states.
|
||||
*/
|
||||
private List<ReferenceOrderedDataState> states = new ArrayList<ReferenceOrderedDataState>();
|
||||
|
||||
/**
|
||||
* Enable debugging output -- todo remove me
|
||||
*/
|
||||
|
|
@ -67,6 +72,8 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
|
|||
GenomeLoc shardLoc = provider.getShard().getGenomeLoc();
|
||||
it.seekForward(GenomeLocParser.createGenomeLoc(shardLoc.getContigIndex(), shardLoc.getStart()-1, shardLoc.getStart()-1));
|
||||
|
||||
states.add(new ReferenceOrderedDataState(dataSource,it));
|
||||
|
||||
// we need to special case the interval so we don't always think there's a rod at the first location
|
||||
if ( dataSource.getName().equals(INTERVAL_ROD_NAME) ) {
|
||||
if ( interval != null )
|
||||
|
|
@ -202,6 +209,9 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
|
|||
* Closes the current view.
|
||||
*/
|
||||
public void close() {
|
||||
for( ReferenceOrderedDataState state: states )
|
||||
state.dataSource.close( state.iterator );
|
||||
|
||||
rodQueue = null;
|
||||
tracker = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue