Handle MastershipEvent sending null #master()
Change-Id: I2243caaf472ec412864557a2c226273227a65f3a
Showing
1 changed file
with
4 additions
and
2 deletions
... | @@ -18,6 +18,7 @@ import org.onlab.onos.cluster.MastershipListener; | ... | @@ -18,6 +18,7 @@ import org.onlab.onos.cluster.MastershipListener; |
18 | import org.onlab.onos.cluster.MastershipService; | 18 | import org.onlab.onos.cluster.MastershipService; |
19 | import org.onlab.onos.cluster.MastershipTermService; | 19 | import org.onlab.onos.cluster.MastershipTermService; |
20 | import org.onlab.onos.cluster.MastershipTerm; | 20 | import org.onlab.onos.cluster.MastershipTerm; |
21 | +import org.onlab.onos.cluster.NodeId; | ||
21 | import org.onlab.onos.event.AbstractListenerRegistry; | 22 | import org.onlab.onos.event.AbstractListenerRegistry; |
22 | import org.onlab.onos.event.EventDeliveryService; | 23 | import org.onlab.onos.event.EventDeliveryService; |
23 | import org.onlab.onos.net.Device; | 24 | import org.onlab.onos.net.Device; |
... | @@ -322,12 +323,13 @@ public class DeviceManager | ... | @@ -322,12 +323,13 @@ public class DeviceManager |
322 | implements MastershipListener { | 323 | implements MastershipListener { |
323 | @Override | 324 | @Override |
324 | public void event(MastershipEvent event) { | 325 | public void event(MastershipEvent event) { |
325 | - if (event.master().equals(clusterService.getLocalNode().id())) { | 326 | + final NodeId myNodeId = clusterService.getLocalNode().id(); |
327 | + if (myNodeId.equals(event.master())) { | ||
326 | 328 | ||
327 | MastershipTerm term = mastershipService.requestTermService() | 329 | MastershipTerm term = mastershipService.requestTermService() |
328 | .getMastershipTerm(event.subject()); | 330 | .getMastershipTerm(event.subject()); |
329 | 331 | ||
330 | - if (term.master().equals(clusterService.getLocalNode().id())) { | 332 | + if (term.master().equals(myNodeId)) { |
331 | // only set the new term if I am the master | 333 | // only set the new term if I am the master |
332 | clockProviderService.setMastershipTerm(event.subject(), term); | 334 | clockProviderService.setMastershipTerm(event.subject(), term); |
333 | } | 335 | } | ... | ... |
-
Please register or login to post a comment