get rid of contended read lock since TimedReference already synchronized
authorAlexey Kudravtsev <cdr@intellij.com>
Mon, 9 Aug 2010 13:30:57 +0000 (17:30 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Tue, 10 Aug 2010 15:52:33 +0000 (19:52 +0400)
platform/lang-impl/src/com/intellij/psi/impl/PsiParameterizedCachedValue.java

index 778931575c04209e25e70b2ee08afeae28311d82..61d31f7ee233bc0f93fc777cbb3012f4776e0a86 100644 (file)
  */
 package com.intellij.psi.impl;
 
+import com.intellij.psi.PsiManager;
 import com.intellij.psi.util.CachedValueProvider;
-import com.intellij.psi.util.ParameterizedCachedValueProvider;
 import com.intellij.psi.util.ParameterizedCachedValue;
-import com.intellij.psi.PsiManager;
-import com.intellij.util.ObjectUtils;
+import com.intellij.psi.util.ParameterizedCachedValueProvider;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-import static com.intellij.util.ObjectUtils.*;
+import static com.intellij.util.ObjectUtils.NULL;
 
 public abstract class PsiParameterizedCachedValue<T,P> extends PsiCachedValue<T> implements ParameterizedCachedValue<T,P> {
 
@@ -45,16 +44,9 @@ public abstract class PsiParameterizedCachedValue<T,P> extends PsiCachedValue<T>
 
   @Nullable
   public T getValue(P param) {
-    r.lock();
-
-    T value;
-    try {
-      value = getUpToDateOrNull();
-      if (value != null) {
-        return value == NULL ? null : value;
-      }
-    } finally {
-      r.unlock();
+    T value = getUpToDateOrNull();
+    if (value != null) {
+      return value == NULL ? null : value;
     }
 
     w.lock();