mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
flush index caches more often and in read action (IDEA-182579)
This commit is contained in:
@@ -988,12 +988,12 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent,
|
||||
final MapReduceIndex index = (MapReduceIndex)state.getIndex(indexId);
|
||||
assert index != null;
|
||||
final MemoryIndexStorage memStorage = (MemoryIndexStorage)index.getStorage();
|
||||
index.getWriteLock().lock();
|
||||
index.getReadLock().lock();
|
||||
try {
|
||||
memStorage.clearCaches();
|
||||
}
|
||||
finally {
|
||||
index.getWriteLock().unlock();
|
||||
index.getReadLock().unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,14 +59,13 @@ public abstract class MapReduceIndex<Key,Value, Input> implements InvertedIndex<
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Lock writeLock = getWriteLock();
|
||||
if (writeLock.tryLock()) {
|
||||
try {
|
||||
myStorage.clearCaches();
|
||||
} finally {
|
||||
writeLock.unlock();
|
||||
}
|
||||
getReadLock().lock();
|
||||
try {
|
||||
myStorage.clearCaches();
|
||||
} finally {
|
||||
getReadLock().unlock();
|
||||
}
|
||||
|
||||
flush();
|
||||
} catch (Throwable e) {
|
||||
requestRebuild(e);
|
||||
|
||||
Reference in New Issue
Block a user