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:
parent
3bbc6a0540
commit
b7e4a015c0
|
|
@ -67,11 +67,19 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile {
|
||||||
ReferenceSequence seq = null;
|
ReferenceSequence seq = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ThreadLocal<Cache> cache = new ThreadLocal<Cache> () {
|
private static ThreadLocal<Cache> cache;
|
||||||
|
|
||||||
|
static {
|
||||||
|
resetThreadLocalCache();
|
||||||
|
};
|
||||||
|
|
||||||
|
protected static void resetThreadLocalCache() {
|
||||||
|
cache = new ThreadLocal<Cache> () {
|
||||||
@Override protected Cache initialValue() {
|
@Override protected Cache initialValue() {
|
||||||
return new Cache();
|
return new Cache();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as general constructor but allows one to override the default cacheSize
|
* Same as general constructor but allows one to override the default cacheSize
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ package org.broadinstitute.sting.utils.fasta;
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
|
import org.testng.annotations.BeforeTest;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.broadinstitute.sting.BaseTest;
|
import org.broadinstitute.sting.BaseTest;
|
||||||
|
|
||||||
import java.io.File;
|
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> 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);
|
||||||
|
|
||||||
|
@BeforeTest
|
||||||
|
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[]>();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue