Make test not so expensive nightly (we want to test only our ref cleanup functionality not concurrency of the backingMap)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1221195 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2011-12-20 10:53:17 +00:00
parent f42b2ffd63
commit 4dc3278d0d
1 changed files with 3 additions and 2 deletions

View File

@ -113,7 +113,8 @@ public class TestWeakIdentityMap extends LuceneTestCase {
} }
public void testConcurrentHashMap() throws Exception { public void testConcurrentHashMap() throws Exception {
final int threadCount = atLeast(32), keyCount = atLeast(1024); // don't make threadCount and keyCount random, otherwise easily OOMs or fails otherwise:
final int threadCount = 8, keyCount = 1024;
final ExecutorService exec = Executors.newFixedThreadPool(threadCount); final ExecutorService exec = Executors.newFixedThreadPool(threadCount);
final WeakIdentityMap<Object,Integer> map = final WeakIdentityMap<Object,Integer> map =
WeakIdentityMap.newConcurrentHashMap(); WeakIdentityMap.newConcurrentHashMap();
@ -127,9 +128,9 @@ public class TestWeakIdentityMap extends LuceneTestCase {
try { try {
for (int t = 0; t < threadCount; t++) { for (int t = 0; t < threadCount; t++) {
final Random rnd = new Random(random.nextLong()); final Random rnd = new Random(random.nextLong());
final int count = atLeast(rnd, 20000);
exec.execute(new Runnable() { exec.execute(new Runnable() {
public void run() { public void run() {
final int count = atLeast(rnd, 10000);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
final int j = rnd.nextInt(keyCount); final int j = rnd.nextInt(keyCount);
switch (rnd.nextInt(4)) { switch (rnd.nextInt(4)) {