mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
IJPL-568 ConcurrentRefValueHashMap.putIfAbsent does not get rid of obsolete references when the insertion succeeds from the first try
GitOrigin-RevId: 377c170b64fc92f732d33ce811601b6d20ea1a73
This commit is contained in:
committed by
intellij-monorepo-bot
parent
9a6807daab
commit
0fe1ce6791
@@ -61,9 +61,9 @@ abstract class ConcurrentRefValueHashMap<K, V> implements ConcurrentMap<K, V> {
|
||||
public V putIfAbsent(@NotNull K key, @NotNull V value) {
|
||||
ValueReference<K, V> newRef = createValueReference(key, value);
|
||||
while (true) {
|
||||
processQueue();
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user