@Override
  public synchronized V putIfAbsent(K key, V value) {
    V oldValue = map.get(key);
    if (oldValue != null) {
      return oldValue;
    }

    WeakHashMap<K, V> tmp = new WeakHashMap<>(map);
    V result = tmp.put(key, value);
    map = Collections.unmodifiableMap(tmp);
    return result;
  }
A copy on write hash map that uses weak references for keys.
geode-core/src/main/java/org/apache/geode/internal/util/concurrent/CopyOnWriteWeakHashMap.java