Make IndexFileDeleter.lastFiles a List<String> instead of List<Collection<String>>

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1521258 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2013-09-09 19:30:51 +00:00
parent 19f9181c74
commit 61d684fe7f
1 changed files with 7 additions and 10 deletions

View File

@ -92,7 +92,7 @@ final class IndexFileDeleter implements Closeable {
/* Holds files we had incref'd from the previous
* non-commit checkpoint: */
private List<Collection<String>> lastFiles = new ArrayList<Collection<String>>();
private final List<String> lastFiles = new ArrayList<String>();
/* Commits that the IndexDeletionPolicy have decided to delete: */
private List<CommitPoint> commitsToDelete = new ArrayList<CommitPoint>();
@ -361,14 +361,13 @@ final class IndexFileDeleter implements Closeable {
refresh(null);
}
@Override
public void close() throws IOException {
// DecRef old files from the last checkpoint, if any:
assert locked();
int size = lastFiles.size();
if (size > 0) {
for(int i=0;i<size;i++) {
decRef(lastFiles.get(i));
}
if (!lastFiles.isEmpty()) {
decRef(lastFiles);
lastFiles.clear();
}
@ -459,13 +458,11 @@ final class IndexFileDeleter implements Closeable {
deleteCommits();
} else {
// DecRef old files from the last checkpoint, if any:
for (Collection<String> lastFile : lastFiles) {
decRef(lastFile);
}
decRef(lastFiles);
lastFiles.clear();
// Save files so we can decr on next checkpoint/commit:
lastFiles.add(segmentInfos.files(directory, false));
lastFiles.addAll(segmentInfos.files(directory, false));
}
if (infoStream.isEnabled("IFD")) {
long t1 = System.nanoTime();