mirror of https://github.com/apache/lucene.git
reduce number of fleeting threads created by this test
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1466884 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4c0f248b19
commit
c197d2d420
|
@ -298,6 +298,9 @@ public class TestStressNRT extends LuceneTestCase {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
IndexReader lastReader = null;
|
||||
IndexSearcher lastSearcher = null;
|
||||
|
||||
while (operations.decrementAndGet() >= 0) {
|
||||
// bias toward a recently changed doc
|
||||
int id = rand.nextInt(100) < 25 ? lastId : rand.nextInt(ndocs);
|
||||
|
@ -318,7 +321,17 @@ public class TestStressNRT extends LuceneTestCase {
|
|||
}
|
||||
|
||||
// sreq = req("wt","json", "q","id:"+Integer.toString(id), "omitHeader","true");
|
||||
IndexSearcher searcher = newSearcher(r);
|
||||
IndexSearcher searcher;
|
||||
if (r == lastReader) {
|
||||
// Just re-use lastSearcher, else
|
||||
// newSearcher may create too many thread
|
||||
// pools (ExecutorService):
|
||||
searcher = lastSearcher;
|
||||
} else {
|
||||
searcher = newSearcher(r);
|
||||
lastReader = r;
|
||||
lastSearcher = searcher;
|
||||
}
|
||||
Query q = new TermQuery(new Term("id",Integer.toString(id)));
|
||||
TopDocs results = searcher.search(q, 10);
|
||||
|
||||
|
|
Loading…
Reference in New Issue