bugfix for rescore ExecutorService must be shut down to close its threads
@@ -24,7 +24,7 @@ public class CosineSimilarityRescorer implements Rescorer {
// Calculate similarity with reference
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
-
+ try {
Future<?>[] tasks = new Future<?>[topDocs.length];
for (int i = 0; i < tasks.length; i++)
tasks[i] = executor.submit(new RescoringTask(reader, fieldName, topDocs[i], referenceTerms, referenceL2Norm));
@@ -45,6 +45,9 @@ public class CosineSimilarityRescorer implements Rescorer {
}
}
}
+ } finally {
+ executor.shutdown();
+ }
}
public static double getL2Norm(Map<String, Float> terms) throws IOException {
