low memory flusher doesn't wait for write lock if it can not be taken at the moment (WEB-23202)

This commit is contained in:
Maxim.Mossienko
2016-09-12 15:04:41 +02:00
parent 9a3d10a2ad
commit 1f3c96cdbd
@@ -82,11 +82,13 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
public void run() {
try {
if (myStorage instanceof MemoryIndexStorage) {
getWriteLock().lock();
try {
((MemoryIndexStorage<Key, Value>)myStorage).clearCaches();
} finally {
getWriteLock().unlock();
Lock writeLock = getWriteLock();
if (writeLock.tryLock()) {
try {
((MemoryIndexStorage<Key, Value>)myStorage).clearCaches();
} finally {
writeLock.unlock();
}
}
}
flush();