leventov commented on a change in pull request #6606: Simplify 
DruidNodeDiscoveryProvider; add 
DruidNodeDiscovery.Listener.nodeViewInitialized()
URL: https://github.com/apache/incubator-druid/pull/6606#discussion_r237240240
 
 

 ##########
 File path: 
server/src/main/java/org/apache/druid/discovery/DruidNodeDiscoveryProvider.java
 ##########
 @@ -66,10 +65,11 @@ public DruidNodeDiscovery getForService(String serviceName)
           if (nodeTypesToWatch == null) {
             throw new IAE("Unknown service [%s].", service);
           }
-
-          ServiceDruidNodeDiscovery serviceDiscovery = new 
ServiceDruidNodeDiscovery(service);
+          ServiceDruidNodeDiscovery serviceDiscovery = new 
ServiceDruidNodeDiscovery(service, nodeTypesToWatch.size());
+          DruidNodeDiscovery.Listener filteringGatheringUpstreamListener =
+              serviceDiscovery.filteringUpstreamListener();
           for (NodeType nodeType : nodeTypesToWatch) {
-            
getForNodeType(nodeType).registerListener(serviceDiscovery.nodeTypeListener());
+            
getForNodeType(nodeType).registerListener(filteringGatheringUpstreamListener);
           }
 
 Review comment:
   Currently it's just `nodeTypesToWatch.size()` passed, hard to imagine how a 
mistake could be made. OTOH separation of concerns makes the whole code much 
more understandable.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to