From 03065fb477c175079b2837a136659992e71f4c73 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Sep 2009 12:41:27 +0400 Subject: [PATCH] re-schedule file for indexing in case of PCE --- .../util/indexing/FileBasedIndex.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java index 56d9f8a7b2ac..4283ed5ae910 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java @@ -1131,7 +1131,9 @@ public class FileBasedIndex implements ApplicationComponent { try { updateSingleIndex(indexId, file, _fc); } - catch (ProcessCanceledException ignored) { + catch (ProcessCanceledException e) { + LOG.info("Re-scheduling file indexing for " + file.getPresentableUrl(), e); + myChangedFilesUpdater.scheduleForUpdate(file); } catch (StorageException e) { requestRebuild(indexId); @@ -1297,14 +1299,8 @@ public class FileBasedIndex implements ApplicationComponent { if (!isTooLarge(file)) { for (ID indexId : myIndices.keySet()) { if (needsFileContentLoading(indexId) && getInputFilter(indexId).acceptInput(file)) { - w.lock(); - try { - myFilesToUpdate.add(file); - break; // no need to iterate further, as the file is already marked - } - finally { - w.unlock(); - } + scheduleForUpdate(file); + break; // no need to iterate further, as the file is already marked } } } @@ -1315,6 +1311,16 @@ public class FileBasedIndex implements ApplicationComponent { IndexingStamp.flushCache(); } + public void scheduleForUpdate(VirtualFile file) { + w.lock(); + try { + myFilesToUpdate.add(file); + } + finally { + w.unlock(); + } + } + void invalidateIndices(final VirtualFile file, final boolean markForReindex) { if (isUnderConfigOrSystem(file)) { return; @@ -1368,13 +1374,7 @@ public class FileBasedIndex implements ApplicationComponent { if (indicesAffected && markForReindex) { iterateIndexableFiles(file, new Processor() { public boolean process(final VirtualFile file) { - w.lock(); - try { - myFilesToUpdate.add(file); - } - finally { - w.unlock(); - } + scheduleForUpdate(file); return true; } });