V (@NotNull K key, @NotNull V value) { ValueReference<K, V> newRef = createValueReference(key, value); while (true) { ValueReference<K, V> oldRef = myMap.putIfAbsent(key, newRef); if (oldRef == null) return null; processQueue(); V oldVal = oldRef.get(); if (oldVal == null) { if (myMap.replace(key, oldRef, newRef)) return null; } else { return oldVal; } } }