Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

Fix problem with open files on windows (this was not caused by Robert's commits, it just did never happen because GC was faster)...

Uwe Schindler023f541b517b
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
index a0a2d0abc8c..2215212e633 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Algorithm.java
@@ -32,7 +32,7 @@ import org.apache.lucene.benchmark.byTask.tasks.TaskSequence;
/**
* Test algorithm, as read from file
*/
-public class Algorithm {
+public class Algorithm implements AutoCloseable {
private TaskSequence sequence;
private final String[] taskPackages;
@@ -358,6 +358,11 @@ public class Algorithm {
}
}
}
+
+ @Override
+ public void close() throws Exception {
+ sequence.close();
+ }
}
diff --git a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java
index 6aefbc88edd..189b273dd1a 100644
--- a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java
+++ b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksParse.java
@@ -133,7 +133,7 @@ public class TestPerfTasksParse extends LuceneTestCase {
config.set("query.maker", MockQueryMaker.class.getName());
}
PerfRunData data = new PerfRunData(config);
- new Algorithm(data);
+ try (Algorithm algo = new Algorithm(data)) {}
foundFiles = true;
}
}