mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
extract ours acceptable indexingThreadCount
This commit is contained in:
@@ -174,10 +174,7 @@ public class CacheUpdateRunner extends DumbModeTask {
|
||||
|
||||
final AtomicBoolean isFinished = new AtomicBoolean();
|
||||
try {
|
||||
int threadsCount = Registry.intValue("caches.indexerThreadsCount");
|
||||
if (threadsCount <= 0) {
|
||||
threadsCount = Math.max(1, Math.min(PROC_COUNT - 1, 4));
|
||||
}
|
||||
int threadsCount = indexingThreadCount();
|
||||
if (threadsCount == 1 || application.isWriteAccessAllowed()) {
|
||||
Runnable process = new MyRunnable(innerIndicator, queue, isFinished, progressUpdater, processInReadAction, project, fileProcessor);
|
||||
ProgressManager.getInstance().runProcess(process, innerIndicator);
|
||||
@@ -201,6 +198,14 @@ public class CacheUpdateRunner extends DumbModeTask {
|
||||
return isFinished.get();
|
||||
}
|
||||
|
||||
public static int indexingThreadCount() {
|
||||
int threadsCount = Registry.intValue("caches.indexerThreadsCount");
|
||||
if (threadsCount <= 0) {
|
||||
threadsCount = Math.max(1, Math.min(PROC_COUNT - 1, 4));
|
||||
}
|
||||
return threadsCount;
|
||||
}
|
||||
|
||||
private static boolean waitForAll(@NotNull AtomicBoolean[] finishedRefs, @NotNull Future<?>[] futures) {
|
||||
assert !ApplicationManager.getApplication().isWriteAccessAllowed();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user