Skip to content

Commit 7ddba3a

Browse files
committed
Just cleanup suggested by IDEA
1 parent 7e0b6e9 commit 7ddba3a

File tree

2 files changed

+12
-55
lines changed

2 files changed

+12
-55
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryGuru.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public final class HistoryGuru {
6868
*/
6969
private static final HistoryGuru INSTANCE = new HistoryGuru();
7070

71+
private final RuntimeEnvironment env;
72+
7173
/**
7274
* The history cache to use.
7375
*/
@@ -91,10 +93,10 @@ public final class HistoryGuru {
9193
* control system.
9294
*/
9395
private HistoryGuru() {
94-
HistoryCache cache = null;
95-
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
96+
env = RuntimeEnvironment.getInstance();
9697
scanningDepth = env.getScanningDepth();
9798

99+
HistoryCache cache = null;
98100
if (env.useHistoryCache()) {
99101
cache = new FileHistoryCache();
100102

@@ -244,7 +246,7 @@ public History getHistory(File file, boolean withFiles, boolean ui)
244246
final File dir = file.isDirectory() ? file : file.getParentFile();
245247
final Repository repo = getRepository(dir);
246248

247-
RemoteSCM rscm = RuntimeEnvironment.getInstance().getRemoteScmSupported();
249+
RemoteSCM rscm = env.getRemoteScmSupported();
248250
boolean doRemote = (ui && (rscm == RemoteSCM.UIONLY))
249251
|| (rscm == RemoteSCM.ON)
250252
|| (ui || ((rscm == RemoteSCM.DIRBASED) && (repo != null) && repo.hasHistoryForDirectories()));
@@ -318,9 +320,9 @@ public boolean hasHistory(File file) {
318320

319321
// This should return true for Annotate view.
320322
return repo.isWorking() && repo.fileHasHistory(file)
321-
&& ((RuntimeEnvironment.getInstance().getRemoteScmSupported() == RemoteSCM.ON)
322-
|| (RuntimeEnvironment.getInstance().getRemoteScmSupported() == RemoteSCM.UIONLY)
323-
|| (RuntimeEnvironment.getInstance().getRemoteScmSupported() == RemoteSCM.DIRBASED)
323+
&& ((env.getRemoteScmSupported() == RemoteSCM.ON)
324+
|| (env.getRemoteScmSupported() == RemoteSCM.UIONLY)
325+
|| (env.getRemoteScmSupported() == RemoteSCM.DIRBASED)
324326
|| !repo.isRemote());
325327
}
326328

@@ -541,8 +543,7 @@ private void createCache(Repository repository, String sinceRevision) {
541543

542544
private void createCacheReal(Collection<Repository> repositories) {
543545
Statistics elapsed = new Statistics();
544-
ExecutorService executor = RuntimeEnvironment.getInstance().
545-
getIndexerParallelizer().getHistoryExecutor();
546+
ExecutorService executor = env.getIndexerParallelizer().getHistoryExecutor();
546547
// Since we know each repository object from the repositories
547548
// collection is unique, we can abuse HashMap to create a list of
548549
// repository,revision tuples with repository as key (as the revision
@@ -704,7 +705,7 @@ public void createCache() {
704705
*/
705706
private List<Repository> getReposFromString(Collection<String> repositories) {
706707
ArrayList<Repository> repos = new ArrayList<>();
707-
File srcRoot = RuntimeEnvironment.getInstance().getSourceRootFile();
708+
File srcRoot = env.getSourceRootFile();
708709

709710
for (String file : repositories) {
710711
File f = new File(srcRoot, file);

opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,6 @@ public IndexDatabase(Project project) throws IOException {
180180
CHECK_FIELDS.add(QueryBuilder.TYPE);
181181
}
182182

183-
/**
184-
* Update the index database for all of the projects. Print progress to
185-
* standard out.
186-
*
187-
* @throws IOException if an error occurs
188-
*/
189-
public static void updateAll() throws IOException {
190-
updateAll(null);
191-
}
192-
193183
/**
194184
* Update the index database for all of the projects.
195185
*
@@ -1248,16 +1238,6 @@ private void indexParallel(String dir, IndexDownArgs args) {
12481238
}
12491239
}
12501240

1251-
/**
1252-
* Interrupt the index generation (and the index generation will stop as
1253-
* soon as possible).
1254-
*/
1255-
public void interrupt() {
1256-
synchronized (lock) {
1257-
interrupted = true;
1258-
}
1259-
}
1260-
12611241
private boolean isInterrupted() {
12621242
synchronized (lock) {
12631243
return interrupted;
@@ -1274,26 +1254,6 @@ public void addIndexChangedListener(IndexChangedListener listener) {
12741254
listeners.add(listener);
12751255
}
12761256

1277-
/**
1278-
* Remove an object from the lists of objects to receive events when
1279-
* modifications is done to the index database.
1280-
*
1281-
* @param listener the object to remove
1282-
*/
1283-
public void removeIndexChangedListener(IndexChangedListener listener) {
1284-
listeners.remove(listener);
1285-
}
1286-
1287-
/**
1288-
* Get all files in all of the index databases.
1289-
*
1290-
* @throws IOException if an error occurs
1291-
* @return set of files
1292-
*/
1293-
public static Set<String> getAllFiles() throws IOException {
1294-
return getAllFiles(null);
1295-
}
1296-
12971257
/**
12981258
* Get all files in some of the index databases.
12991259
*
@@ -1400,10 +1360,6 @@ public int getNumFiles() throws IOException {
14001360
return numDocs;
14011361
}
14021362

1403-
static void listFrequentTokens() throws IOException {
1404-
listFrequentTokens(null);
1405-
}
1406-
14071363
static void listFrequentTokens(List<String> subFiles) throws IOException {
14081364
final int limit = 4;
14091365

@@ -1796,12 +1752,12 @@ private boolean xrefExistsFor(String path) {
17961752
return true;
17971753
}
17981754

1799-
private class IndexDownArgs {
1755+
private static class IndexDownArgs {
18001756
int cur_count;
18011757
final List<IndexFileWork> works = new ArrayList<>();
18021758
}
18031759

1804-
private class IndexFileWork {
1760+
private static class IndexFileWork {
18051761
final File file;
18061762
final String path;
18071763
Exception exception;

0 commit comments

Comments
 (0)