From 2bf1fbc15ae10c2dc274065b8709396c1b0fe250 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Tue, 11 Feb 2014 19:01:24 +0100 Subject: [PATCH] don't use vfs in vfs events if old build isn't enabled at least for one project --- .../compiler/impl/TranslatingCompilerFilesMonitor.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java index fdd1587f24a8..88f35211cf3b 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/TranslatingCompilerFilesMonitor.java @@ -89,6 +89,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { private final Object myDataLock = new Object(); private final TIntHashSet mySuspendedProjects = new TIntHashSet(); // projectId for all projects that should not be monitored + private volatile int myWatchedProjectsCount; private final TIntObjectHashMap mySourcesToRecompile = new TIntObjectHashMap(); // ProjectId->set of source file paths private PersistentHashMap>> myOutputRootsStorage; // ProjectId->map[moduleId->Pair(outputDirId, testOutputDirId)] @@ -195,6 +196,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { return; } FileUtil.createIfDoesntExist(CompilerPaths.getRebuildMarkerFile(project)); + --myWatchedProjectsCount; // cleanup internal structures to free memory mySourcesToRecompile.remove(projectId); myOutputsToDelete.remove(projectId); @@ -216,6 +218,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { public void watchProject(Project project) { synchronized (myDataLock) { mySuspendedProjects.remove(getProjectId(project)); + ++myWatchedProjectsCount; } } @@ -1473,6 +1476,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { } public void beforeFileDeletion(final VirtualFileEvent event) { + if (myWatchedProjectsCount == 0) return; final VirtualFile eventFile = event.getFile(); if ((LOG.isDebugEnabled() && eventFile.isDirectory()) || ourDebugMode) { final String message = "Processing file deletion: " + eventFile.getPresentableUrl(); @@ -1612,6 +1616,7 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent { } private void processNewFile(final VirtualFile file, final boolean notifyServer) { + if (myWatchedProjectsCount == 0) return; final Ref isInContent = Ref.create(false); ApplicationManager.getApplication().runReadAction(new Runnable() { // need read action to ensure that the project was not disposed during the iteration over the project list