Madan Jampani
Committed by Gerrit Code Review

Fix ConsistentMap.putIfAbsent logic

Change-Id: Id3dcd6558a2c0a3db2055966a8610cc9f2d1cf7f
...@@ -277,7 +277,7 @@ public class DefaultAsyncConsistentMap<K, V> implements AsyncConsistentMap<K, V> ...@@ -277,7 +277,7 @@ public class DefaultAsyncConsistentMap<K, V> implements AsyncConsistentMap<K, V>
277 public CompletableFuture<Versioned<V>> putIfAbsent(K key, V value) { 277 public CompletableFuture<Versioned<V>> putIfAbsent(K key, V value) {
278 checkNotNull(key, ERROR_NULL_KEY); 278 checkNotNull(key, ERROR_NULL_KEY);
279 checkNotNull(value, ERROR_NULL_VALUE); 279 checkNotNull(value, ERROR_NULL_VALUE);
280 - return computeIfAbsent(key, k -> value); 280 + return updateAndGet(key, Match.ifNull(), Match.any(), value).thenApply(v -> v.oldValue());
281 } 281 }
282 282
283 @Override 283 @Override
......