diff --git a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java index 535e0719a333..f611db8016ac 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java @@ -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 {