commit | 05acd64e10d4e40bdf042d690f097dcb19c0ace9 | [log] [tgz] |
---|---|---|
author | Brian O'Connor <bocon@onlab.us> | Wed Aug 03 00:42:35 2016 -0700 |
committer | Thomas Vachuska <tom@onlab.us> | Wed Aug 03 15:05:51 2016 +0000 |
tree | 40f0f1a23a78da3b737e084f60d84da3172e4535 | |
parent | d03d7dd559fe34422e7044776f7d73c562670980 [diff] |
ECMap: Avoid new mapvalue if raw values are equal Change-Id: I84fa9bcada9ea9da1e0c43f61106a9d91fc60e62
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/EventuallyConsistentMapImpl.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/EventuallyConsistentMapImpl.java index 97711af..ffbb0c5 100644 --- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/EventuallyConsistentMapImpl.java +++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/impl/EventuallyConsistentMapImpl.java
@@ -416,6 +416,10 @@ MapValue<V> computedValue = items.compute(serializer.copy(key), (k, mv) -> { previousValue.set(mv); V newRawValue = recomputeFunction.apply(key, mv == null ? null : mv.get()); + if (mv != null && Objects.equals(newRawValue, mv.get())) { + // value was not updated + return mv; + } MapValue<V> newValue = new MapValue<>(newRawValue, timestampProvider.apply(key, newRawValue)); if (mv == null || newValue.isNewerThan(mv)) { updated.set(true);