mirror of https://github.com/apache/lucene.git
Closing IndexInput after every use
This commit is contained in:
parent
4406d75b00
commit
dc3d6fc9c1
|
@ -81,8 +81,6 @@ public class DocIdEncodingBenchmark {
|
|||
|
||||
private Path tmpDir;
|
||||
|
||||
private IndexInput in;
|
||||
|
||||
private final int[] scratch = new int[512];
|
||||
|
||||
private String decoderInputFile;
|
||||
|
@ -126,8 +124,8 @@ public class DocIdEncodingBenchmark {
|
|||
Files.delete(tmpDir.resolve(outputFile));
|
||||
}
|
||||
} else if (methodName.equalsIgnoreCase("decode")) {
|
||||
try (Directory dir = FSDirectory.open(tmpDir)) {
|
||||
in = dir.openInput(decoderInputFile, IOContext.DEFAULT);
|
||||
try (Directory dir = FSDirectory.open(tmpDir);
|
||||
IndexInput in = dir.openInput(decoderInputFile, IOContext.DEFAULT)) {
|
||||
for (int[] docIdSequence : DOC_ID_SEQUENCES) {
|
||||
for (int i = 1; i <= INPUT_SCALE_FACTOR; i++) {
|
||||
docIdEncoder.decode(in, 0, docIdSequence.length, scratch);
|
||||
|
@ -543,6 +541,5 @@ public class DocIdEncodingBenchmark {
|
|||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue