Skip to content

finish rename of executor for individual files #3640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public final class Configuration {
private boolean indexVersionedFilesOnly;
private int indexingParallelism;
private int historyParallelism;
private int historyRenamedParallelism;
private int historyFileParallelism;
private boolean tagsEnabled;
private int hitsPerPage;
private int cachePages;
Expand Down Expand Up @@ -1154,12 +1154,12 @@ public void setHistoryParallelism(int value) {
this.historyParallelism = Math.max(value, 0);
}

public int getHistoryRenamedParallelism() {
return historyRenamedParallelism;
public int getHistoryFileParallelism() {
return historyFileParallelism;
}

public void setHistoryRenamedParallelism(int value) {
this.historyRenamedParallelism = Math.max(value, 0);
public void setHistoryFileParallelism(int value) {
this.historyFileParallelism = Math.max(value, 0);
}

public boolean isTagsEnabled() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1118,12 +1118,12 @@ public int getHistoryParallelism() {
}

/**
* Gets the value of {@link Configuration#getHistoryRenamedParallelism()} -- or
* Gets the value of {@link Configuration#getHistoryFileParallelism()} -- or
* if zero, then as a default gets the number of available processors.
* @return a natural number >= 1
*/
public int getHistoryRenamedParallelism() {
int parallelism = syncReadConfiguration(Configuration::getHistoryRenamedParallelism);
public int getHistoryFileParallelism() {
int parallelism = syncReadConfiguration(Configuration::getHistoryFileParallelism);
return parallelism < 1 ? Runtime.getRuntime().availableProcessors() :
parallelism;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,15 +566,16 @@ public static String[] parseOptions(String[] argv) throws ParseException {
parser.on("-H", "--history", "Enable history.").execute(v -> cfg.setHistoryEnabled(true));

parser.on("--historyThreads", "=number", Integer.class,
"The number of threads to use for history cache generation. By default the number",
"of threads will be set to the number of available CPUs. Assumes -H/--history.").execute(threadCount ->
"The number of threads to use for history cache generation on repository level. " +
"By default the number of threads will be set to the number of available CPUs.",
"Assumes -H/--history.").execute(threadCount ->
cfg.setHistoryParallelism((Integer) threadCount));

parser.on("--historyRenamedThreads", "=number", Integer.class,
"The number of threads to use for history cache generation when dealing with renamed files.",
parser.on("--historyFileThreads", "=number", Integer.class,
"The number of threads to use for history cache generation when dealing with individual files.",
"By default the number of threads will be set to the number of available CPUs.",
"Assumes --renamedHistory=on").execute(threadCount ->
cfg.setHistoryRenamedParallelism((Integer) threadCount));
"Assumes -H/--history.").execute(threadCount ->
cfg.setHistoryFileParallelism((Integer) threadCount));

parser.on("-I", "--include", "=pattern",
"Only files matching this pattern will be examined. Pattern supports",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public IndexerParallelizer(RuntimeEnvironment env) {
createLazyCtagsPool();
createLazyFixedExecutor();
createLazyHistoryExecutor();
createLazyHistoryRenamedExecutor();
createLazyHistoryFileExecutor();
createLazyCtagsWatcherExecutor();
}

Expand Down Expand Up @@ -197,7 +197,7 @@ private void bounceHistoryExecutor() {
private void bounceHistoryRenamedExecutor() {
if (lzHistoryFileExecutor.isActive()) {
ExecutorService formerHistoryRenamedExecutor = lzHistoryFileExecutor.get();
createLazyHistoryRenamedExecutor();
createLazyHistoryFileExecutor();
formerHistoryRenamedExecutor.shutdown();
}
}
Expand Down Expand Up @@ -240,9 +240,9 @@ private void createLazyHistoryExecutor() {
Executors.newFixedThreadPool(env.getHistoryParallelism()));
}

private void createLazyHistoryRenamedExecutor() {
private void createLazyHistoryFileExecutor() {
lzHistoryFileExecutor = LazilyInstantiate.using(() ->
Executors.newFixedThreadPool(env.getHistoryRenamedParallelism()));
Executors.newFixedThreadPool(env.getHistoryFileParallelism()));
}

private class CtagsObjectFactory implements ObjectFactory<Ctags> {
Expand Down