Java 类com.intellij.util.SofterReference 实例源码

项目:intellij-ce-playground    文件:SofterCache.java   
public V getCachedValue(T key) {
  SofterReference<ConcurrentMap<T, V>> ref = myCache;
  ConcurrentMap<T, V> map = ref == null ? null : ref.get();
  if (map == null) {
    myCache = new SofterReference<ConcurrentMap<T, V>>(map = ContainerUtil.newConcurrentMap());
  }
  V value = map.get(key);
  if (value == null) {
    map.put(key, value = myValueProvider.fun(key));
  }
  return value;
}
项目:tools-idea    文件:SofterCache.java   
public V getCachedValue(T key) {
  SofterReference<ConcurrentMap<T, V>> ref = myCache;
  ConcurrentMap<T, V> map = ref == null ? null : ref.get();
  if (map == null) {
    myCache = new SofterReference<ConcurrentMap<T, V>>(map = new ConcurrentHashMap<T, V>());
  }
  V value = map.get(key);
  if (value == null) {
    map.put(key, value = myValueProvider.fun(key));
  }
  return value;
}
项目:consulo-xml    文件:SofterCache.java   
public V getCachedValue(T key) {
  SofterReference<ConcurrentMap<T, V>> ref = myCache;
  ConcurrentMap<T, V> map = ref == null ? null : ref.get();
  if (map == null) {
    myCache = new SofterReference<ConcurrentMap<T, V>>(map = new ConcurrentHashMap<T, V>());
  }
  V value = map.get(key);
  if (value == null) {
    map.put(key, value = myValueProvider.fun(key));
  }
  return value;
}