static thread cache reset in UnitTest

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4870 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
depristo 2010-12-17 21:53:10 +00:00
parent 3bbc6a0540
commit b7e4a015c0
2 changed files with 19 additions and 4 deletions

View File

@ -67,12 +67,20 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile {
ReferenceSequence seq = null;
}
private static ThreadLocal<Cache> cache = new ThreadLocal<Cache> () {
@Override protected Cache initialValue() {
return new Cache();
}
private static ThreadLocal<Cache> cache;
static {
resetThreadLocalCache();
};
protected static void resetThreadLocalCache() {
cache = new ThreadLocal<Cache> () {
@Override protected Cache initialValue() {
return new Cache();
}
};
}
/**
* Same as general constructor but allows one to override the default cacheSize
* @param file

View File

@ -8,6 +8,8 @@ package org.broadinstitute.sting.utils.fasta;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.BeforeMethod;
import org.broadinstitute.sting.BaseTest;
import java.io.File;
@ -30,6 +32,11 @@ public class CachingIndexedFastaSequenceFileUnitTest extends BaseTest {
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);
@BeforeTest
public void clearCache() {
CachingIndexedFastaSequenceFile.resetThreadLocalCache();
}
@DataProvider(name = "fastas")
public Object[][] createData1() {
List<Object[]> params = new ArrayList<Object[]>();