small fix to Mastership event EntryListener for inverted condition check
Change-Id: Idd830437efb3766e82f8c6601ddd5ea7b33bf108
Conflicts:
core/store/dist/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java
index 713be4e..42e0799 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/mastership/impl/DistributedMastershipStore.java
@@ -447,13 +447,16 @@
RoleValue oldValue = event.getOldValue();
RoleValue newValue = event.getValue();
+ // There will be no oldValue at the very first instance of an EntryEvent.
+ // Technically, the progression is: null event -> null master -> some master;
+ // We say a null master and a null oldValue are the same condition.
NodeId oldMaster = null;
if (oldValue != null) {
oldMaster = oldValue.get(MASTER);
}
NodeId newMaster = newValue.get(MASTER);
- if (Objects.equal(oldMaster, newMaster)) {
+ if (!Objects.equal(oldMaster, newMaster)) {
notifyDelegate(new MastershipEvent(
MASTER_CHANGED, event.getKey(), event.getValue().roleInfo()));
} else {