Refactor AtomixConsistentMap to use separate operations per method call for better performance and control over operation semantics.
Change-Id: I948c5c73d4ab38c9c2b20f8c80ba01548f95dda6
diff --git a/core/api/src/main/java/org/onosproject/store/service/MapEvent.java b/core/api/src/main/java/org/onosproject/store/service/MapEvent.java
index 818e749..2e8aa61 100644
--- a/core/api/src/main/java/org/onosproject/store/service/MapEvent.java
+++ b/core/api/src/main/java/org/onosproject/store/service/MapEvent.java
@@ -62,12 +62,25 @@
* @param previousValue value that was replaced
*/
public MapEvent(String name, K key, Versioned<V> currentValue, Versioned<V> previousValue) {
+ this(currentValue != null ? previousValue != null ? Type.UPDATE : Type.INSERT : Type.REMOVE,
+ name, key, currentValue, previousValue);
+ }
+
+ /**
+ * Creates a new event object.
+ *
+ * @param type event type
+ * @param name map name
+ * @param key key the event concerns
+ * @param currentValue new value key is mapped to
+ * @param previousValue value that was replaced
+ */
+ public MapEvent(Type type, String name, K key, Versioned<V> currentValue, Versioned<V> previousValue) {
+ this.type = type;
this.name = name;
this.key = key;
this.newValue = currentValue;
this.oldValue = previousValue;
- this.type = currentValue != null ?
- previousValue != null ? Type.UPDATE : Type.INSERT : Type.REMOVE;
}
/**