mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
access to indices after disposal doesn't lead to NPE (IDEA-164170)
This commit is contained in:
@@ -74,6 +74,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
|
||||
private PersistentHashMap<Integer, Integer> myInputsSnapshotMapping;
|
||||
@Nullable protected PersistentHashMap<Integer, Collection<Key>> myInputsIndex;
|
||||
private PersistentHashMap<Integer, String> myIndexingTrace;
|
||||
private volatile boolean myDisposed;
|
||||
|
||||
private final ReentrantReadWriteLock myLock = new ReentrantReadWriteLock();
|
||||
|
||||
@@ -329,6 +330,7 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
|
||||
LOG.error(e);
|
||||
}
|
||||
finally {
|
||||
myDisposed = true;
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
@@ -389,6 +391,9 @@ public class MapReduceIndex<Key, Value, Input> implements UpdatableIndex<Key,Val
|
||||
final Lock lock = getReadLock();
|
||||
try {
|
||||
lock.lock();
|
||||
if (myDisposed) {
|
||||
return new ValueContainerImpl<>();
|
||||
}
|
||||
ValueContainerImpl.ourDebugIndexInfo.set(myIndexId);
|
||||
return myStorage.read(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user