Sequences: Push @SuppressWarnings down to call sites
Change-Id: Ic915ec40af1bffb8aae3661e972ae0c3a0391c4d
This commit is contained in:
@@ -32,7 +32,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.eclipse.jgit.lib.Config;
|
import org.eclipse.jgit.lib.Config;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class Sequences {
|
public class Sequences {
|
||||||
public static final String CHANGES = "changes";
|
public static final String CHANGES = "changes";
|
||||||
@@ -56,18 +55,15 @@ public class Sequences {
|
|||||||
this.migration = migration;
|
this.migration = migration;
|
||||||
|
|
||||||
int gap = getChangeSequenceGap(cfg);
|
int gap = getChangeSequenceGap(cfg);
|
||||||
changeSeq =
|
@SuppressWarnings("deprecation")
|
||||||
new RepoSequence(
|
RepoSequence.Seed seed = () -> db.get().nextChangeId() + gap;
|
||||||
repoManager,
|
int batchSize = cfg.getInt("noteDb", "changes", "sequenceBatchSize", 20);
|
||||||
allProjects,
|
changeSeq = new RepoSequence(repoManager, allProjects, CHANGES, seed, batchSize);
|
||||||
CHANGES,
|
|
||||||
() -> db.get().nextChangeId() + gap,
|
|
||||||
cfg.getInt("noteDb", "changes", "sequenceBatchSize", 20));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int nextChangeId() throws OrmException {
|
public int nextChangeId() throws OrmException {
|
||||||
if (!migration.readChangeSequence()) {
|
if (!migration.readChangeSequence()) {
|
||||||
return db.get().nextChangeId();
|
return nextChangeId(db.get());
|
||||||
}
|
}
|
||||||
return changeSeq.next();
|
return changeSeq.next();
|
||||||
}
|
}
|
||||||
@@ -84,7 +80,7 @@ public class Sequences {
|
|||||||
List<Integer> ids = new ArrayList<>(count);
|
List<Integer> ids = new ArrayList<>(count);
|
||||||
ReviewDb db = this.db.get();
|
ReviewDb db = this.db.get();
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
ids.add(db.nextChangeId());
|
ids.add(nextChangeId(db));
|
||||||
}
|
}
|
||||||
return ImmutableList.copyOf(ids);
|
return ImmutableList.copyOf(ids);
|
||||||
}
|
}
|
||||||
@@ -93,4 +89,9 @@ public class Sequences {
|
|||||||
public RepoSequence getChangeIdRepoSequence() {
|
public RepoSequence getChangeIdRepoSequence() {
|
||||||
return changeSeq;
|
return changeSeq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private static int nextChangeId(ReviewDb db) throws OrmException {
|
||||||
|
return db.nextChangeId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user