LUCENE-3583: more safety changes to benchmark

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1204851 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2011-11-22 08:14:50 +00:00
parent 67db0ed9d1
commit cfe863797c
4 changed files with 13 additions and 3 deletions

View File

@ -17,6 +17,7 @@ package org.apache.lucene.benchmark.byTask;
* limitations under the License.
*/
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
@ -66,7 +67,7 @@ import org.apache.lucene.util.IOUtils;
* <li><b>taxonomy.directory</b>=&lt;type of directory for taxonomy index| Default: RAMDirectory&gt;
* </ul>
*/
public class PerfRunData {
public class PerfRunData implements Closeable {
private Points points;
@ -124,6 +125,12 @@ public class PerfRunData {
}
}
public void close() throws IOException {
IOUtils.close(indexWriter, indexReader, indexSearcher, directory,
taxonomyWriter, taxonomyReader, taxonomyDir,
docMaker, facetSource);
}
// clean old stuff, reopen
public void reinit(boolean eraseIndex) throws Exception {

View File

@ -17,6 +17,7 @@ package org.apache.lucene.benchmark.byTask.feeds;
* limitations under the License.
*/
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@ -46,7 +47,7 @@ import org.apache.lucene.benchmark.byTask.utils.Format;
* logStep is not 0 (<b>default=0</b>).
* </ul>
*/
public abstract class ContentItemsSource {
public abstract class ContentItemsSource implements Closeable {
private long bytesCount;
private long totalBytesCount;

View File

@ -17,6 +17,7 @@ package org.apache.lucene.benchmark.byTask.feeds;
* limitations under the License.
*/
import java.io.Closeable;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
@ -75,7 +76,7 @@ import org.apache.lucene.document.TextField;
* {@link DocData#getProps()} will be indexed. (default <b>false</b>).
* </ul>
*/
public class DocMaker {
public class DocMaker implements Closeable {
private static class LeftOver {
private DocData docdata;

View File

@ -155,6 +155,7 @@ public class LineDocSourceTest extends BenchmarkTestCase {
searcher.close();
reader.close();
runData.close();
}
/* Tests LineDocSource with a bzip2 input stream. */