LUCENE-5303: clear cache before each test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1535215 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-10-24 00:04:45 +00:00
parent 3a594688a5
commit 6455445730
2 changed files with 9 additions and 2 deletions

View File

@ -100,7 +100,7 @@ public class OrdinalsCache {
// reference. When it's no longer referenced, the entire inner map can be // reference. When it's no longer referenced, the entire inner map can be
// evicted. // evicted.
private static final Map<Object,Map<String,CachedOrds>> ordsCache = new WeakHashMap<Object,Map<String,CachedOrds>>(); private static final Map<Object,Map<String,CachedOrds>> ordsCache = new WeakHashMap<Object,Map<String,CachedOrds>>();
/** /**
* Returns the {@link CachedOrds} relevant to the given * Returns the {@link CachedOrds} relevant to the given
* {@link AtomicReaderContext}, or {@code null} if there is no * {@link AtomicReaderContext}, or {@code null} if there is no
@ -141,4 +141,9 @@ public class OrdinalsCache {
} }
return size; return size;
} }
/** Clears all entries from the cache. */
public synchronized static void clear() {
ordsCache.clear();
}
} }

View File

@ -72,7 +72,9 @@ public class OrdinalsCacheTest extends FacetTestCase {
} }
}; };
} }
OrdinalsCache.clear();
long ramBytesUsed = 0; long ramBytesUsed = 0;
for (Thread t : threads) { for (Thread t : threads) {
t.start(); t.start();