Committed by
Gerrit Code Review
ONOS-2292: Use the passed in value to generate timestamp in ECMap's remove(key, value) method
Change-Id: Ic2fe04a72d8f9c63431ee48a4d0b78005b694142
Showing
1 changed file
with
2 additions
and
1 deletions
... | @@ -313,6 +313,7 @@ public class EventuallyConsistentMapImpl<K, V> | ... | @@ -313,6 +313,7 @@ public class EventuallyConsistentMapImpl<K, V> |
313 | public V remove(K key) { | 313 | public V remove(K key) { |
314 | checkState(!destroyed, destroyedMessage); | 314 | checkState(!destroyed, destroyedMessage); |
315 | checkNotNull(key, ERROR_NULL_KEY); | 315 | checkNotNull(key, ERROR_NULL_KEY); |
316 | + // TODO prevent calls here if value is important for timestamp | ||
316 | MapValue<V> tombstone = new MapValue<>(null, timestampProvider.apply(key, null)); | 317 | MapValue<V> tombstone = new MapValue<>(null, timestampProvider.apply(key, null)); |
317 | MapValue<V> previousValue = removeInternal(key, Optional.empty(), tombstone); | 318 | MapValue<V> previousValue = removeInternal(key, Optional.empty(), tombstone); |
318 | return previousValue != null ? previousValue.get() : null; | 319 | return previousValue != null ? previousValue.get() : null; |
... | @@ -323,7 +324,7 @@ public class EventuallyConsistentMapImpl<K, V> | ... | @@ -323,7 +324,7 @@ public class EventuallyConsistentMapImpl<K, V> |
323 | checkState(!destroyed, destroyedMessage); | 324 | checkState(!destroyed, destroyedMessage); |
324 | checkNotNull(key, ERROR_NULL_KEY); | 325 | checkNotNull(key, ERROR_NULL_KEY); |
325 | checkNotNull(value, ERROR_NULL_VALUE); | 326 | checkNotNull(value, ERROR_NULL_VALUE); |
326 | - MapValue<V> tombstone = new MapValue<>(null, timestampProvider.apply(key, null)); | 327 | + MapValue<V> tombstone = new MapValue<>(null, timestampProvider.apply(key, value)); |
327 | removeInternal(key, Optional.of(value), tombstone); | 328 | removeInternal(key, Optional.of(value), tombstone); |
328 | } | 329 | } |
329 | 330 | ... | ... |
-
Please register or login to post a comment