Long-delayed change to CachingIndexedFastaSequenceFile. Made the cache

non-static to avoid problems when multiple references are used within the same
thread (eg., during integration tests). This should kill the intermittent
IndelRealignerIntegrationTest failures.
This commit is contained in:
David Roazen 2011-07-01 16:04:30 -04:00
parent 11d4af0e75
commit d647ea4fdc
2 changed files with 4 additions and 9 deletions

View File

@ -68,13 +68,13 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile {
ReferenceSequence seq = null; ReferenceSequence seq = null;
} }
private static ThreadLocal<Cache> cache; private ThreadLocal<Cache> cache;
static { {
resetThreadLocalCache(); resetThreadLocalCache();
}; }
protected static void resetThreadLocalCache() { protected void resetThreadLocalCache() {
cache = new ThreadLocal<Cache> () { cache = new ThreadLocal<Cache> () {
@Override protected Cache initialValue() { @Override protected Cache initialValue() {
return new Cache(); return new Cache();

View File

@ -34,11 +34,6 @@ public class CachingIndexedFastaSequenceFileUnitTest extends BaseTest {
private static final List<Integer> QUERY_SIZES = Arrays.asList(1, 10, 100, 1000); private static final List<Integer> QUERY_SIZES = Arrays.asList(1, 10, 100, 1000);
private static final List<Integer> CACHE_SIZES = Arrays.asList(-1, 10, 1000); private static final List<Integer> CACHE_SIZES = Arrays.asList(-1, 10, 1000);
@BeforeMethod
public void clearCache() {
CachingIndexedFastaSequenceFile.resetThreadLocalCache();
}
@DataProvider(name = "fastas") @DataProvider(name = "fastas")
public Object[][] createData1() { public Object[][] createData1() {
List<Object[]> params = new ArrayList<Object[]>(); List<Object[]> params = new ArrayList<Object[]>();