Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-1257: CommitPoint -> IndexCommit in generics

Uwe Schindler1c0678d1489c
diff --git a/src/java/org/apache/lucene/index/IndexDeletionPolicy.java b/src/java/org/apache/lucene/index/IndexDeletionPolicy.java
index d17c43e28b6..1308d5f4c96 100644
--- a/src/java/org/apache/lucene/index/IndexDeletionPolicy.java
+++ b/src/java/org/apache/lucene/index/IndexDeletionPolicy.java
@@ -70,7 +70,7 @@ public interface IndexDeletionPolicy {
* {@link IndexCommit point-in-time commits},
* sorted by age (the 0th one is the oldest commit).
*/
- public void onInit(List<IndexCommit> commits) throws IOException;
+ public void onInit(List<? extends IndexCommit> commits) throws IOException;
/**
* <p>This is called each time the writer completed a commit.
@@ -94,5 +94,5 @@ public interface IndexDeletionPolicy {
* @param commits List of {@link IndexCommit},
* sorted by age (the 0th one is the oldest commit).
*/
- public void onCommit(List<IndexCommit> commits) throws IOException;
+ public void onCommit(List<? extends IndexCommit> commits) throws IOException;
}
diff --git a/src/java/org/apache/lucene/index/IndexFileDeleter.java b/src/java/org/apache/lucene/index/IndexFileDeleter.java
index 6e8044fec00..77ebcaff909 100644
--- a/src/java/org/apache/lucene/index/IndexFileDeleter.java
+++ b/src/java/org/apache/lucene/index/IndexFileDeleter.java
@@ -84,14 +84,14 @@ final class IndexFileDeleter {
* default delete policy (KeepOnlyLastCommitDeletionPolicy).
* Other policies may leave commit points live for longer
* in which case this list would be longer than 1: */
- private List commits = new ArrayList();
+ private List<CommitPoint> commits = new ArrayList<CommitPoint>();
/* Holds files we had incref'd from the previous
* non-commit checkpoint: */
private List<Collection<String>> lastFiles = new ArrayList<Collection<String>>();
/* Commits that the IndexDeletionPolicy have decided to delete: */
- private List commitsToDelete = new ArrayList();
+ private List<CommitPoint> commitsToDelete = new ArrayList<CommitPoint>();
private PrintStream infoStream;
private Directory directory;
@@ -565,13 +565,13 @@ final class IndexFileDeleter {
String segmentsFileName;
boolean deleted;
Directory directory;
- Collection<IndexCommit> commitsToDelete;
+ Collection<CommitPoint> commitsToDelete;
long version;
long generation;
final boolean isOptimized;
final Map<String,String> userData;
- public CommitPoint(Collection<IndexCommit> commitsToDelete, Directory directory, SegmentInfos segmentInfos) throws IOException {
+ public CommitPoint(Collection<CommitPoint> commitsToDelete, Directory directory, SegmentInfos segmentInfos) throws IOException {
this.directory = directory;
this.commitsToDelete = commitsToDelete;
userData = segmentInfos.getUserData();
diff --git a/src/java/org/apache/lucene/index/KeepOnlyLastCommitDeletionPolicy.java b/src/java/org/apache/lucene/index/KeepOnlyLastCommitDeletionPolicy.java
index a2ce3ba19de..f73b97a5e49 100644
--- a/src/java/org/apache/lucene/index/KeepOnlyLastCommitDeletionPolicy.java
+++ b/src/java/org/apache/lucene/index/KeepOnlyLastCommitDeletionPolicy.java
@@ -31,7 +31,7 @@ public final class KeepOnlyLastCommitDeletionPolicy implements IndexDeletionPoli
/**
* Deletes all commits except the most recent one.
*/
- public void onInit(List<IndexCommit> commits) {
+ public void onInit(List<? extends IndexCommit> commits) {
// Note that commits.size() should normally be 1:
onCommit(commits);
}
@@ -39,7 +39,7 @@ public final class KeepOnlyLastCommitDeletionPolicy implements IndexDeletionPoli
/**
* Deletes all commits except the most recent one.
*/
- public void onCommit(List<IndexCommit> commits) {
+ public void onCommit(List<? extends IndexCommit> commits) {
// Note that commits.size() should normally be 2 (if not
// called by onInit above):
int size = commits.size();
diff --git a/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java b/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java
index 4f29bb1b8f5..7da7ac5d58e 100644
--- a/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java
+++ b/src/java/org/apache/lucene/index/SnapshotDeletionPolicy.java
@@ -52,12 +52,12 @@ public class SnapshotDeletionPolicy implements IndexDeletionPolicy {
this.primary = primary;
}
- public synchronized void onInit(List<IndexCommit> commits) throws IOException {
+ public synchronized void onInit(List<? extends IndexCommit> commits) throws IOException {
primary.onInit(wrapCommits(commits));
lastCommit = commits.get(commits.size()-1);
}
- public synchronized void onCommit(List<IndexCommit> commits) throws IOException {
+ public synchronized void onCommit(List<? extends IndexCommit> commits) throws IOException {
primary.onCommit(wrapCommits(commits));
lastCommit = commits.get(commits.size()-1);
}
@@ -123,7 +123,7 @@ public class SnapshotDeletionPolicy implements IndexDeletionPolicy {
}
}
- private List<IndexCommit> wrapCommits(List<IndexCommit> commits) {
+ private List<IndexCommit> wrapCommits(List<? extends IndexCommit> commits) {
final int count = commits.size();
List<IndexCommit> myCommits = new ArrayList<IndexCommit>(count);
for(int i=0;i<count;i++)