private void testDetectorOnAll(Detector detector, Path[] toTest, int numThreads, int numIterations, int randomlyResizeSAXPool) {
Map<Path, MediaType> truth = getBaselineDetection(detector, toTest);
if (truth.size() == 0) {
return;
}
Path[] testFiles = new Path[truth.size()];
int j = 0;
for (Path testFile : truth.keySet()) {
testFiles[j++] = testFile;
}
int actualThreadCount = numThreads + ((randomlyResizeSAXPool > 0) ? randomlyResizeSAXPool : 0);
ExecutorService ex = Executors.newFixedThreadPool(actualThreadCount);
try {
_testDetectorOnAll(detector, testFiles, numThreads, numIterations, truth, ex, randomlyResizeSAXPool);
} finally {
ex.shutdown();
ex.shutdownNow();
}
}