mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
additionally guard iterateIndexableFiles / pushedproperty updating as not all processor can run concurrently
This commit is contained in:
+3
-1
@@ -289,7 +289,7 @@ public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater
|
||||
tasks.add(iteration);
|
||||
}
|
||||
|
||||
if (Registry.is("idea.concurrent.scanning.files.to.index")) {
|
||||
if (ourConcurrentlyFlag.get() == Boolean.TRUE && Registry.is("idea.concurrent.scanning.files.to.index")) {
|
||||
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(tasks, null, false, new Processor<Runnable>() {
|
||||
@Override
|
||||
public boolean process(Runnable runnable) {
|
||||
@@ -302,6 +302,8 @@ public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater
|
||||
}
|
||||
}
|
||||
|
||||
public static final ThreadLocal<Boolean> ourConcurrentlyFlag = new ThreadLocal<Boolean>();
|
||||
|
||||
private void applyPushersToFile(final VirtualFile fileOrDir, final FilePropertyPusher[] pushers, final Object[] moduleValues) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -1791,7 +1791,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
}
|
||||
|
||||
private void scheduleUpdate(@NotNull ID<?, ?> indexId, @NotNull Computable<Boolean> update, @NotNull Runnable successRunnable) {
|
||||
if (myNotRequiringContentIndices.contains(indexId)) {
|
||||
if (myNotRequiringContentIndices.contains(indexId) /*&& !Registry.is("idea.concurrent.scanning.files.to.index")*/) {
|
||||
myContentlessIndicesUpdateQueue.submit(update, successRunnable);
|
||||
}
|
||||
else {
|
||||
@@ -2570,6 +2570,8 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
}
|
||||
}
|
||||
|
||||
public static final ThreadLocal<Boolean> ourConcurrentlyFlag = new ThreadLocal<Boolean>();
|
||||
|
||||
@Override
|
||||
public void iterateIndexableFiles(@NotNull final ContentIterator processor, @NotNull final Project project, final ProgressIndicator indicator) {
|
||||
if (project.isDisposed()) {
|
||||
@@ -2655,7 +2657,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
|
||||
}
|
||||
}
|
||||
|
||||
if (Registry.is("idea.concurrent.scanning.files.to.index")) {
|
||||
if (ourConcurrentlyFlag.get() == Boolean.TRUE && Registry.is("idea.concurrent.scanning.files.to.index")) {
|
||||
JobLauncher.getInstance().invokeConcurrentlyUnderProgress(tasks, indicator, true, false, new Processor<Runnable>() {
|
||||
@Override
|
||||
public boolean process(Runnable runnable) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.roots.CollectingContentIterator;
|
||||
import com.intellij.openapi.roots.ModuleRootAdapter;
|
||||
import com.intellij.openapi.roots.ModuleRootEvent;
|
||||
import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater;
|
||||
import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdaterImpl;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.Consumer;
|
||||
@@ -62,7 +63,13 @@ public class UnindexedFilesUpdater extends DumbModeTask {
|
||||
|
||||
private void updateUnindexedFiles(ProgressIndicator indicator) {
|
||||
long started = System.currentTimeMillis();
|
||||
PushedFilePropertiesUpdater.getInstance(myProject).pushAllPropertiesNow();
|
||||
PushedFilePropertiesUpdaterImpl.ourConcurrentlyFlag.set(Boolean.TRUE);
|
||||
try {
|
||||
PushedFilePropertiesUpdater.getInstance(myProject).pushAllPropertiesNow();
|
||||
} finally {
|
||||
PushedFilePropertiesUpdaterImpl.ourConcurrentlyFlag.set(null);
|
||||
}
|
||||
|
||||
LOG.info("Pushed properties in " + (System.currentTimeMillis() - started) + " ms");
|
||||
|
||||
indicator.setIndeterminate(true);
|
||||
@@ -70,7 +77,13 @@ public class UnindexedFilesUpdater extends DumbModeTask {
|
||||
|
||||
CollectingContentIterator finder = myIndex.createContentIterator(indicator);
|
||||
long l = System.currentTimeMillis();
|
||||
myIndex.iterateIndexableFiles(finder, myProject, indicator);
|
||||
FileBasedIndexImpl.ourConcurrentlyFlag.set(Boolean.TRUE);
|
||||
try {
|
||||
myIndex.iterateIndexableFiles(finder, myProject, indicator);
|
||||
} finally {
|
||||
FileBasedIndexImpl.ourConcurrentlyFlag.set(null);
|
||||
}
|
||||
|
||||
myIndex.filesUpdateEnumerationFinished();
|
||||
|
||||
LOG.info("Indexable files iterated in " + (System.currentTimeMillis() - l) + " ms");
|
||||
|
||||
Reference in New Issue
Block a user