Eliminate the peformance penalty introduced in ReplicaInfoService.getReplicaInfoFor
Change-Id: Ie37d7e80c4dbf37a2ae6f452f6f66f4505d69a29
diff --git a/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java b/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java
index d33ac203..6011c16 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/flow/ReplicaInfo.java
@@ -22,6 +22,7 @@
import org.onosproject.cluster.NodeId;
+import com.google.common.base.Objects;
import com.google.common.base.Optional;
/**
@@ -61,6 +62,21 @@
return backups;
}
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(master, backups);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof ReplicaInfo)) {
+ return false;
+ }
+ ReplicaInfo that = (ReplicaInfo) other;
+ return Objects.equal(this.master, that.master) &&
+ Objects.equal(this.backups, that.backups);
+ }
+
// for Serializer
private ReplicaInfo() {
this.master = Optional.absent();