diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java index 5d24fe6e3fa..ff4bd5b2bb0 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java @@ -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; *
  • taxonomy.directory=<type of directory for taxonomy index| Default: RAMDirectory> * */ -public class PerfRunData { +public class PerfRunData implements Closeable { private Points points; @@ -123,6 +124,12 @@ public class PerfRunData { System.out.println(getQueryMaker(new SearchTask(this)).printQueries()); } } + + 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 { diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ContentItemsSource.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ContentItemsSource.java index 20f75829b64..36738c2d8d4 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ContentItemsSource.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ContentItemsSource.java @@ -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 (default=0). * */ -public abstract class ContentItemsSource { +public abstract class ContentItemsSource implements Closeable { private long bytesCount; private long totalBytesCount; diff --git a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java index a324cdcf491..609b2313268 100644 --- a/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java +++ b/modules/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/DocMaker.java @@ -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 false). * */ -public class DocMaker { +public class DocMaker implements Closeable { private static class LeftOver { private DocData docdata; diff --git a/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java b/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java index 413515fa8f3..dc65739aad1 100644 --- a/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java +++ b/modules/benchmark/src/test/org/apache/lucene/benchmark/byTask/feeds/LineDocSourceTest.java @@ -155,6 +155,7 @@ public class LineDocSourceTest extends BenchmarkTestCase { searcher.close(); reader.close(); + runData.close(); } /* Tests LineDocSource with a bzip2 input stream. */