Thomas Vachuska
Committed by Gerrit Code Review

Fixed an issue where only the new device master node would receive mastership change events.

Change-Id: I08a6530c57c91f006994412b4dfbfb3c16571593
...@@ -400,9 +400,7 @@ public class ConsistentDeviceMastershipStore ...@@ -400,9 +400,7 @@ public class ConsistentDeviceMastershipStore
400 if (!isDeviceMastershipTopic(leadership.topic())) { 400 if (!isDeviceMastershipTopic(leadership.topic())) {
401 return; 401 return;
402 } 402 }
403 - NodeId nodeId = leadership.leader();
404 DeviceId deviceId = extractDeviceIdFromTopic(leadership.topic()); 403 DeviceId deviceId = extractDeviceIdFromTopic(leadership.topic());
405 - if (Objects.equal(nodeId, localNodeId) && connectedDevices.contains(deviceId)) {
406 switch (event.type()) { 404 switch (event.type()) {
407 case LEADER_ELECTED: 405 case LEADER_ELECTED:
408 notifyDelegate(new MastershipEvent(MASTER_CHANGED, deviceId, getNodes(deviceId))); 406 notifyDelegate(new MastershipEvent(MASTER_CHANGED, deviceId, getNodes(deviceId)));
...@@ -421,7 +419,6 @@ public class ConsistentDeviceMastershipStore ...@@ -421,7 +419,6 @@ public class ConsistentDeviceMastershipStore
421 } 419 }
422 } 420 }
423 } 421 }
424 - }
425 422
426 private String createDeviceMastershipTopic(DeviceId deviceId) { 423 private String createDeviceMastershipTopic(DeviceId deviceId) {
427 return String.format("device:%s", deviceId.toString()); 424 return String.format("device:%s", deviceId.toString());
......