From 1f3c96cdbdf6006b8024850e2bac9ad4140f9153 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Mon, 12 Sep 2016 15:03:06 +0200 Subject: [PATCH] low memory flusher doesn't wait for write lock if it can not be taken at the moment (WEB-23202) --- .../com/intellij/util/indexing/MapReduceIndex.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java index 53577b44493b..dad726119b41 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/MapReduceIndex.java @@ -82,11 +82,13 @@ public class MapReduceIndex implements UpdatableIndex)myStorage).clearCaches(); - } finally { - getWriteLock().unlock(); + Lock writeLock = getWriteLock(); + if (writeLock.tryLock()) { + try { + ((MemoryIndexStorage)myStorage).clearCaches(); + } finally { + writeLock.unlock(); + } } } flush();