prevent too many open files in test

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1039068 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-11-25 15:12:29 +00:00
parent 3c47af1bf0
commit 66c8234469
2 changed files with 9 additions and 0 deletions

View File

@ -349,6 +349,9 @@ public class TestIndexWriterReader extends LuceneTestCase {
void close(boolean doWait) throws Throwable {
didClose = true;
if (doWait) {
mainWriter.waitForMerges();
}
mainWriter.close(doWait);
}

View File

@ -231,5 +231,11 @@ public class _TestUtil {
// keep number of open files lowish
LogMergePolicy lmp = (LogMergePolicy) w.getMergePolicy();
lmp.setMergeFactor(Math.min(5, lmp.getMergeFactor()));
MergeScheduler ms = w.getConfig().getMergeScheduler();
if (ms instanceof ConcurrentMergeScheduler) {
((ConcurrentMergeScheduler) ms).setMaxThreadCount(2);
((ConcurrentMergeScheduler) ms).setMaxMergeCount(3);
}
}
}