srdo 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_r281019939
 
 

 ##########
 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:
   Added a comment. NodeHost can't be null here, since we're iterating over 
newConnections. newConnections is only non-empty if assignment is not null.
   
   I looked at rewriting this to make that clearer, but didn't like how it 
turned out.

----------------------------------------------------------------
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

Reply via email to