mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
less duplicated code
This commit is contained in:
@@ -44,8 +44,8 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: Dec 20, 2007
|
||||
*/
|
||||
* Date: Dec 20, 2007
|
||||
*/
|
||||
public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Value>{
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.util.indexing.MapIndexStorage");
|
||||
private static final boolean ENABLE_CACHED_HASH_IDS = SystemProperties.getBooleanProperty("idea.index.no.cashed.hashids", true);
|
||||
@@ -64,16 +64,7 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu
|
||||
private final LowMemoryWatcher myLowMemoryFlusher = LowMemoryWatcher.register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
l.lock();
|
||||
try {
|
||||
if (!myMap.isClosed()) {
|
||||
myCache.clear();
|
||||
if (myMap.isDirty()) myMap.force();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
l.unlock();
|
||||
}
|
||||
flush();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -158,11 +149,11 @@ public final class MapIndexStorage<Key, Value> implements IndexStorage<Key, Valu
|
||||
public void flush() {
|
||||
l.lock();
|
||||
try {
|
||||
if (!myMap.isClosed() && myMap.isDirty()) {
|
||||
if (!myMap.isClosed()) {
|
||||
myCache.clear();
|
||||
myMap.force();
|
||||
if (myMap.isDirty()) myMap.force();
|
||||
}
|
||||
if (myKeyHashToVirtualFileMapping != null) myKeyHashToVirtualFileMapping.force();
|
||||
if (myKeyHashToVirtualFileMapping != null && myKeyHashToVirtualFileMapping.isDirty()) myKeyHashToVirtualFileMapping.force();
|
||||
}
|
||||
finally {
|
||||
l.unlock();
|
||||
|
||||
Reference in New Issue
Block a user