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
Showing
1 changed file
with
4 additions
and
1 deletions
| ... | @@ -447,13 +447,16 @@ implements MastershipStore { | ... | @@ -447,13 +447,16 @@ implements MastershipStore { |
| 447 | RoleValue oldValue = event.getOldValue(); | 447 | RoleValue oldValue = event.getOldValue(); |
| 448 | RoleValue newValue = event.getValue(); | 448 | RoleValue newValue = event.getValue(); |
| 449 | 449 | ||
| 450 | + // There will be no oldValue at the very first instance of an EntryEvent. | ||
| 451 | + // Technically, the progression is: null event -> null master -> some master; | ||
| 452 | + // We say a null master and a null oldValue are the same condition. | ||
| 450 | NodeId oldMaster = null; | 453 | NodeId oldMaster = null; |
| 451 | if (oldValue != null) { | 454 | if (oldValue != null) { |
| 452 | oldMaster = oldValue.get(MASTER); | 455 | oldMaster = oldValue.get(MASTER); |
| 453 | } | 456 | } |
| 454 | NodeId newMaster = newValue.get(MASTER); | 457 | NodeId newMaster = newValue.get(MASTER); |
| 455 | 458 | ||
| 456 | - if (Objects.equal(oldMaster, newMaster)) { | 459 | + if (!Objects.equal(oldMaster, newMaster)) { |
| 457 | notifyDelegate(new MastershipEvent( | 460 | notifyDelegate(new MastershipEvent( |
| 458 | MASTER_CHANGED, event.getKey(), event.getValue().roleInfo())); | 461 | MASTER_CHANGED, event.getKey(), event.getValue().roleInfo())); |
| 459 | } else { | 462 | } else { | ... | ... |
-
Please register or login to post a comment