Remove crazy scanning for method, its easier that way!

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1584894 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2014-04-04 20:30:07 +00:00
parent 8d4fd19f9f
commit 34edcdc515
1 changed files with 5 additions and 20 deletions

View File

@ -759,28 +759,13 @@ public abstract class LuceneTestCase extends Assert {
int maxNumThreadStates = rarely(r) ? TestUtil.nextInt(r, 5, 20) // crazy value
: TestUtil.nextInt(r, 1, 4); // reasonable value
Method setIndexerThreadPoolMethod = null;
try {
// Retrieve the package-private setIndexerThreadPool
// method:
for(Method m : IndexWriterConfig.class.getDeclaredMethods()) {
if (m.getName().equals("setIndexerThreadPool")) {
m.setAccessible(true);
setIndexerThreadPoolMethod = m;
break;
}
}
} catch (Exception e) {
// Should not happen?
Rethrow.rethrow(e);
}
if (setIndexerThreadPoolMethod == null) {
throw new RuntimeException("failed to lookup IndexWriterConfig.setIndexerThreadPool method");
}
try {
if (rarely(r)) {
// Retrieve the package-private setIndexerThreadPool
// method:
Method setIndexerThreadPoolMethod = IndexWriterConfig.class.getDeclaredMethod("setIndexerThreadPool",
Class.forName("org.apache.lucene.index.DocumentsWriterPerThreadPool"));
setIndexerThreadPoolMethod.setAccessible(true);
Class<?> clazz = Class.forName("org.apache.lucene.index.RandomDocumentsWriterPerThreadPool");
Constructor<?> ctor = clazz.getConstructor(int.class, Random.class);
ctor.setAccessible(true);