HeartSaVioR commented on a change in pull request #2998: STORM-3379: Fix
intermittent NPE during worker boot in local mode
URL: https://github.com/apache/storm/pull/2998#discussion_r281017058
##########
File path: storm-client/src/jvm/org/apache/storm/daemon/worker/WorkerState.java
##########
@@ -393,14 +400,15 @@ public void refreshConnections() {
Set<NodeInfo> newConnections = Sets.difference(neededConnections,
currentConnections);
Set<NodeInfo> removeConnections = Sets.difference(currentConnections,
neededConnections);
+ Map<String, String> nodeHost = assignment != null ?
assignment.get_node_host() : null;
// Add new connections atomically
cachedNodeToPortSocket.getAndUpdate(prev -> {
Map<NodeInfo, IConnection> next = new HashMap<>(prev);
for (NodeInfo nodeInfo : newConnections) {
next.put(nodeInfo,
mqContext.connect(
topologyId,
-
assignment.get_node_host().get(nodeInfo.get_node()), // Host
+ nodeHost.get(nodeInfo.get_node()), // Host
Review comment:
It could throw NPE when assignment is null since nodeHost will be null. If
there's some assumption this line will not be evaluated when assignment is
null, may be better to leave a comment describing it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services