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.
|
* A view into the reference-ordered data in the provider.
|
||||||
*/
|
*/
|
||||||
public class ManagingReferenceOrderedView implements ReferenceOrderedView {
|
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.
|
* The data sources along with their current states.
|
||||||
*/
|
*/
|
||||||
|
|
@ -41,7 +36,6 @@ public class ManagingReferenceOrderedView implements ReferenceOrderedView {
|
||||||
* @param provider
|
* @param provider
|
||||||
*/
|
*/
|
||||||
public ManagingReferenceOrderedView( ShardDataProvider provider ) {
|
public ManagingReferenceOrderedView( ShardDataProvider provider ) {
|
||||||
//this.provider = provider;
|
|
||||||
for( ReferenceOrderedDataSource dataSource: provider.getReferenceOrderedData() )
|
for( ReferenceOrderedDataSource dataSource: provider.getReferenceOrderedData() )
|
||||||
states.add( new ReferenceOrderedDataState( dataSource, (SeekableRODIterator)dataSource.seek(provider.getShard()) ) );
|
states.add( new ReferenceOrderedDataState( dataSource, (SeekableRODIterator)dataSource.seek(provider.getShard()) ) );
|
||||||
|
|
||||||
|
|
@ -72,11 +66,12 @@ public class ManagingReferenceOrderedView implements ReferenceOrderedView {
|
||||||
// Clear out the existing data so that post-close() accesses to this data will fail-fast.
|
// Clear out the existing data so that post-close() accesses to this data will fail-fast.
|
||||||
states = null;
|
states = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models the traversal state of a given ROD lane.
|
* Models the traversal state of a given ROD lane.
|
||||||
*/
|
*/
|
||||||
private class ReferenceOrderedDataState {
|
class ReferenceOrderedDataState {
|
||||||
public final ReferenceOrderedDataSource dataSource;
|
public final ReferenceOrderedDataSource dataSource;
|
||||||
public final SeekableRODIterator iterator;
|
public final SeekableRODIterator iterator;
|
||||||
|
|
||||||
|
|
@ -84,5 +79,4 @@ public class ManagingReferenceOrderedView implements ReferenceOrderedView {
|
||||||
this.dataSource = dataSource;
|
this.dataSource = dataSource;
|
||||||
this.iterator = iterator;
|
this.iterator = iterator;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -39,6 +39,11 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
|
||||||
// broken support for multi-locus rods
|
// broken support for multi-locus rods
|
||||||
//List<ReferenceOrderedDatum> multiLocusRODs = new LinkedList<ReferenceOrderedDatum>();
|
//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
|
* Enable debugging output -- todo remove me
|
||||||
*/
|
*/
|
||||||
|
|
@ -67,6 +72,8 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
|
||||||
GenomeLoc shardLoc = provider.getShard().getGenomeLoc();
|
GenomeLoc shardLoc = provider.getShard().getGenomeLoc();
|
||||||
it.seekForward(GenomeLocParser.createGenomeLoc(shardLoc.getContigIndex(), shardLoc.getStart()-1, shardLoc.getStart()-1));
|
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
|
// 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 ( dataSource.getName().equals(INTERVAL_ROD_NAME) ) {
|
||||||
if ( interval != null )
|
if ( interval != null )
|
||||||
|
|
@ -202,6 +209,9 @@ public class RodLocusView extends LocusView implements ReferenceOrderedView {
|
||||||
* Closes the current view.
|
* Closes the current view.
|
||||||
*/
|
*/
|
||||||
public void close() {
|
public void close() {
|
||||||
|
for( ReferenceOrderedDataState state: states )
|
||||||
|
state.dataSource.close( state.iterator );
|
||||||
|
|
||||||
rodQueue = null;
|
rodQueue = null;
|
||||||
tracker = null;
|
tracker = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue