ensure a unique sem chunk per file

This commit is contained in:
peter
2012-07-26 19:55:26 +02:00
parent 9add7fba64
commit 313da5e6a7
@@ -312,8 +312,12 @@ public class SemServiceImpl extends SemService{
private ConcurrentMap<SemKey, List<SemElement>> cacheOrGetMap(final PsiElement element, @NotNull PsiElement root) {
FileChunk chunk = obtainChunk(root);
if (chunk == null) {
chunk = new FileChunk(root);
myCache.putIfAbsent(root, new SoftReference(chunk));
synchronized (myCache) {
chunk = obtainChunk(root);
if (chunk == null) {
myCache.put(root, new SoftReference(chunk = new FileChunk(root)));
}
}
}
ConcurrentMap<SemKey, List<SemElement>> map = chunk.map.get(element);