Committed by
Gerrit Code Review
Fix NPE caused by pushing events about nodes no longer in the cluster
Change-Id: I7a1da3d7824b07b446194d651ef4945f1305bce3
Showing
1 changed file
with
5 additions
and
0 deletions
... | @@ -258,6 +258,11 @@ public class DistributedClusterStore | ... | @@ -258,6 +258,11 @@ public class DistributedClusterStore |
258 | private void notifyStateChange(NodeId nodeId, State oldState, State newState) { | 258 | private void notifyStateChange(NodeId nodeId, State oldState, State newState) { |
259 | if (oldState != newState) { | 259 | if (oldState != newState) { |
260 | ControllerNode node = allNodes.get(nodeId); | 260 | ControllerNode node = allNodes.get(nodeId); |
261 | + // Either this node or that node is no longer part of the same cluster | ||
262 | + if (node == null) { | ||
263 | + log.warn("Could not find node {} in the cluster, ignoring state change", node); | ||
264 | + return; | ||
265 | + } | ||
261 | ClusterEvent.Type type = newState == State.READY ? INSTANCE_READY : | 266 | ClusterEvent.Type type = newState == State.READY ? INSTANCE_READY : |
262 | newState == State.ACTIVE ? INSTANCE_ACTIVATED : | 267 | newState == State.ACTIVE ? INSTANCE_ACTIVATED : |
263 | INSTANCE_DEACTIVATED; | 268 | INSTANCE_DEACTIVATED; | ... | ... |
-
Please register or login to post a comment