additionally guard iterateIndexableFiles / pushedproperty updating as not all process... appcode/142.508 clion/142.509 dbe/142.510 idea/142.505 phpstorm/142.504 phpstorm/142.512 pycharm/142.506 rubymine/142.507 webstorm/142.511
authorMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Sat, 28 Mar 2015 01:12:05 +0000 (02:12 +0100)
committerMaxim.Mossienko <Maxim.Mossienko@jetbrains.com>
Sat, 28 Mar 2015 01:12:05 +0000 (02:12 +0100)
platform/lang-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdaterImpl.java
platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java
platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java

index 52e1101d346f313a5705c414c943fc28db8abe8c..bc8954816b1d67c08cde2d2d97873f4e602fd121 100644 (file)
@@ -289,7 +289,7 @@ public class PushedFilePropertiesUpdaterImpl extends PushedFilePropertiesUpdater
       tasks.add(iteration);
     }
 
       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) {
       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
   private void applyPushersToFile(final VirtualFile fileOrDir, final FilePropertyPusher[] pushers, final Object[] moduleValues) {
     ApplicationManager.getApplication().runReadAction(new Runnable() {
       @Override
index b5ae17f8f67459cce3b0e72015d31a39b522e6b3..4156dff8ee5779ce7a380195926fef44c416eeac 100644 (file)
@@ -1791,7 +1791,7 @@ public class FileBasedIndexImpl extends FileBasedIndex {
   }
 
   private void scheduleUpdate(@NotNull ID<?, ?> indexId, @NotNull Computable<Boolean> update, @NotNull Runnable successRunnable) {
   }
 
   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 {
       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()) {
   @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) {
       JobLauncher.getInstance().invokeConcurrentlyUnderProgress(tasks, indicator, true, false, new Processor<Runnable>() {
         @Override
         public boolean process(Runnable runnable) {
index aa3bddddb68edbcec112a1b95da16446a07400cd..db88233c8a0eab8f8156615482eaf3a05a29de3f 100644 (file)
@@ -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.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;
 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();
 
   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);
     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();
 
     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");
     myIndex.filesUpdateEnumerationFinished();
 
     LOG.info("Indexable files iterated in " + (System.currentTimeMillis() - l) + " ms");