Jonathan Hart

DistibutedClusterStore: use notifyDelegate to prevent NPE

Change-Id: I56b981355b02face3a5bb09d2ca2e2bd29f7c715
...@@ -264,7 +264,7 @@ public class DistributedClusterStore ...@@ -264,7 +264,7 @@ public class DistributedClusterStore
264 ControllerNode node = new DefaultControllerNode(nodeId, ip, tcpPort); 264 ControllerNode node = new DefaultControllerNode(nodeId, ip, tcpPort);
265 allNodes.put(node.id(), node); 265 allNodes.put(node.id(), node);
266 updateState(nodeId, State.INACTIVE); 266 updateState(nodeId, State.INACTIVE);
267 - delegate.notify(new ClusterEvent(ClusterEvent.Type.INSTANCE_ADDED, node)); 267 + notifyDelegate(new ClusterEvent(ClusterEvent.Type.INSTANCE_ADDED, node));
268 return node; 268 return node;
269 } 269 }
270 270
...@@ -274,7 +274,7 @@ public class DistributedClusterStore ...@@ -274,7 +274,7 @@ public class DistributedClusterStore
274 ControllerNode node = allNodes.remove(nodeId); 274 ControllerNode node = allNodes.remove(nodeId);
275 if (node != null) { 275 if (node != null) {
276 nodeStates.remove(nodeId); 276 nodeStates.remove(nodeId);
277 - delegate.notify(new ClusterEvent(ClusterEvent.Type.INSTANCE_REMOVED, node)); 277 + notifyDelegate(new ClusterEvent(ClusterEvent.Type.INSTANCE_REMOVED, node));
278 } 278 }
279 } 279 }
280 280
...@@ -344,9 +344,9 @@ public class DistributedClusterStore ...@@ -344,9 +344,9 @@ public class DistributedClusterStore
344 private void notifyStateChange(NodeId nodeId, State oldState, State newState) { 344 private void notifyStateChange(NodeId nodeId, State oldState, State newState) {
345 ControllerNode node = allNodes.get(nodeId); 345 ControllerNode node = allNodes.get(nodeId);
346 if (newState == State.ACTIVE) { 346 if (newState == State.ACTIVE) {
347 - delegate.notify(new ClusterEvent(ClusterEvent.Type.INSTANCE_ACTIVATED, node)); 347 + notifyDelegate(new ClusterEvent(ClusterEvent.Type.INSTANCE_ACTIVATED, node));
348 } else { 348 } else {
349 - delegate.notify(new ClusterEvent(ClusterEvent.Type.INSTANCE_DEACTIVATED, node)); 349 + notifyDelegate(new ClusterEvent(ClusterEvent.Type.INSTANCE_DEACTIVATED, node));
350 } 350 }
351 } 351 }
352 352
......