Skip to content

Commit c257077

Browse files
author
Vladimir Kotal
committed
simplify
1 parent 8df660a commit c257077

File tree

5 files changed

+2
-54
lines changed

5 files changed

+2
-54
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Configuration.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ public final class Configuration {
195195
private int indexingParallelism;
196196
private int historyParallelism;
197197
private int historyRenamedParallelism;
198-
private int repositorySearchParallelism;
199198
private boolean tagsEnabled;
200199
private int hitsPerPage;
201200
private int cachePages;
@@ -1146,14 +1145,6 @@ public void setHistoryRenamedParallelism(int value) {
11461145
this.historyRenamedParallelism = value > 0 ? value : 0;
11471146
}
11481147

1149-
public int getRepositorySearchParallelism() {
1150-
return repositorySearchParallelism;
1151-
}
1152-
1153-
public void setRepositorySearchParallelism(int value) {
1154-
this.repositorySearchParallelism = value > 0 ? value : 0;
1155-
}
1156-
11571148
public boolean isTagsEnabled() {
11581149
return this.tagsEnabled;
11591150
}

opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/RuntimeEnvironment.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,17 +1110,6 @@ public int getHistoryRenamedParallelism() {
11101110
parallelism;
11111111
}
11121112

1113-
/**
1114-
* Gets the value of {@link Configuration#getRepositorySearchParallelism()} -- or
1115-
* if zero, then as a default gets the number of available processors.
1116-
* @return a natural number >= 1
1117-
*/
1118-
public int getRepositorySearchParallelism() {
1119-
int parallelism = syncReadConfiguration(Configuration::getRepositorySearchParallelism);
1120-
return parallelism < 1 ? Runtime.getRuntime().availableProcessors() :
1121-
parallelism;
1122-
}
1123-
11241113
public boolean isTagsEnabled() {
11251114
return syncReadConfiguration(Configuration::isTagsEnabled);
11261115
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ private Collection<RepositoryInfo> addRepositories(File[] files,
478478
* @return collection of added repositories
479479
*/
480480
public Collection<RepositoryInfo> addRepositories(File[] files) {
481-
ExecutorService executor = env.getIndexerParallelizer().getRepositorySearchExecutor();
481+
ExecutorService executor = env.getIndexerParallelizer().getFixedExecutor();
482482
List<Future<Collection<RepositoryInfo>>> futures = new ArrayList<>();
483483
for (File file: files) {
484484
futures.add(executor.submit(() -> addRepositories(new File[]{file},
@@ -494,8 +494,6 @@ public Collection<RepositoryInfo> addRepositories(File[] files) {
494494
}
495495
});
496496

497-
env.getIndexerParallelizer().bounceRepositorySearchExecutor();
498-
499497
return repoList;
500498
}
501499

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,7 @@ public static String[] parseOptions(String[] argv) throws ParseException {
746746
"The number of threads to use for index generation and repository scan.",
747747
"By default the number of threads will be set to the number of available",
748748
"CPUs. This influences the number of spawned ctags processes as well.").
749-
execute(threadCount -> {
750-
cfg.setIndexingParallelism((Integer) threadCount);
751-
cfg.setRepositorySearchParallelism((Integer) threadCount);
752-
});
749+
execute(threadCount -> cfg.setIndexingParallelism((Integer) threadCount));
753750

754751
parser.on("-t", "--tabSize", "=number", Integer.class,
755752
"Default tab size to use (number of spaces per tab character).")

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public class IndexerParallelizer implements AutoCloseable {
6262
private LazilyInstantiate<ExecutorService> lzHistoryExecutor;
6363
private LazilyInstantiate<ExecutorService> lzHistoryRenamedExecutor;
6464
private LazilyInstantiate<ExecutorService> lzCtagsWatcherExecutor;
65-
private LazilyInstantiate<ExecutorService> lzRepositorySearchExecutor;
6665

6766
/**
6867
* Initializes a new instance using settings from the specified environment
@@ -86,7 +85,6 @@ public IndexerParallelizer(RuntimeEnvironment env) {
8685
createLazyHistoryExecutor();
8786
createLazyHistoryRenamedExecutor();
8887
createLazyCtagsWatcherExecutor();
89-
createLazyRepositorySearchExecutor();
9088
}
9189

9290
/**
@@ -131,13 +129,6 @@ public ExecutorService getCtagsWatcherExecutor() {
131129
return lzCtagsWatcherExecutor.get();
132130
}
133131

134-
/**
135-
* @return the ExecutorService used for repository scan
136-
*/
137-
public ExecutorService getRepositorySearchExecutor() {
138-
return lzRepositorySearchExecutor.get();
139-
}
140-
141132
/**
142133
* Calls {@link #bounce()}, which prepares for -- but does not start -- new
143134
* pools.
@@ -170,7 +161,6 @@ public void bounce() {
170161
bounceHistoryExecutor();
171162
bounceHistoryRenamedExecutor();
172163
bounceCtagsWatcherExecutor();
173-
bounceRepositorySearchExecutor();
174164
}
175165

176166
private void bounceForkJoinPool() {
@@ -221,18 +211,6 @@ private void bounceCtagsWatcherExecutor() {
221211
}
222212
}
223213

224-
/**
225-
* Shutdown the executor used for repository search.
226-
* @see #bounce()
227-
*/
228-
public void bounceRepositorySearchExecutor() {
229-
if (lzRepositorySearchExecutor.isActive()) {
230-
ExecutorService formerRepositorySearchExecutor = lzRepositorySearchExecutor.get();
231-
createLazyRepositorySearchExecutor();
232-
formerRepositorySearchExecutor.shutdown();
233-
}
234-
}
235-
236214
private void createLazyForkJoinPool() {
237215
lzForkJoinPool = LazilyInstantiate.using(() ->
238216
new ForkJoinPool(indexingParallelism));
@@ -268,11 +246,6 @@ private void createLazyHistoryRenamedExecutor() {
268246
Executors.newFixedThreadPool(env.getHistoryRenamedParallelism()));
269247
}
270248

271-
private void createLazyRepositorySearchExecutor() {
272-
lzRepositorySearchExecutor = LazilyInstantiate.using(() ->
273-
Executors.newFixedThreadPool(env.getRepositorySearchParallelism()));
274-
}
275-
276249
private class CtagsObjectFactory implements ObjectFactory<Ctags> {
277250

278251
public Ctags createNew() {

0 commit comments

Comments
 (0)