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_r237169967
 
 

 ##########
 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:
   It mixes the concerns of `registerListener()`, making code harder to 
understand and more error-prone. It was part of the reason why I spent so much 
time understanding this code in the first place and why I created this PR.

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