From 4ccaa2d4a99d46fe2e3f10541cb8b7415be02646 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Fri, 21 Jun 2013 13:47:09 +0200 Subject: [PATCH] only scheduleForUpdate / flush stamps on PCE --- .../util/indexing/FileBasedIndexImpl.java | 26 +++++++++++-------- .../util/indexing/UnindexedFilesUpdater.java | 7 +++-- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index fc5961c441e0..f23ec9fbd8cb 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -1764,7 +1764,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { } catch (ProcessCanceledException e) { cleanFileContent(fc, psiFile); - myChangedFilesCollector.invalidateIndicesForFile(file, true); + myChangedFilesCollector.scheduleForUpdate(file); throw e; } catch (StorageException e) { @@ -2232,20 +2232,24 @@ public class FileBasedIndexImpl extends FileBasedIndex { final VirtualFile file = fileContent.getVirtualFile(); final boolean reallyRemoved = myFilesToUpdate.remove(file); if (reallyRemoved && file.isValid()) { - if (onlyRemoveOutdatedData || isTooLarge(file)) { - // on shutdown there is no need to re-index the file, just remove outdated data from indices - final List> affected = new ArrayList>(); - for (final ID indexId : myRequiringContentIndices) { // non requiring content indices should be flushed - if (getInputFilter(indexId).acceptInput(file)) { - affected.add(indexId); + try { + if (onlyRemoveOutdatedData || isTooLarge(file)) { + // on shutdown there is no need to re-index the file, just remove outdated data from indices + final List> affected = new ArrayList>(); + for (final ID indexId : myRequiringContentIndices) { // non requiring content indices should be flushed + if (getInputFilter(indexId).acceptInput(file)) { + affected.add(indexId); + } } + removeFileDataFromIndices(affected, file); + } + else { + indexFileContent(project, fileContent); } - removeFileDataFromIndices(affected, file); } - else { - indexFileContent(project, fileContent); + finally { + IndexingStamp.flushCache(file); } - IndexingStamp.flushCache(file); } } } diff --git a/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java b/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java index 994654a57740..beba11bac658 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesUpdater.java @@ -65,8 +65,11 @@ public class UnindexedFilesUpdater implements CacheUpdater { @Override public void processFile(final FileContent fileContent) { - myIndex.indexFileContent(myProject, fileContent); - IndexingStamp.flushCache(fileContent.getVirtualFile()); + try { + myIndex.indexFileContent(myProject, fileContent); + } finally { + IndexingStamp.flushCache(fileContent.getVirtualFile()); + } } @Override