public DruidNodeDiscovery getForService ( String serviceName ) { return serviceDiscoveryMap . computeIfAbsent ( serviceName , service -> { Set < NodeType > nodeTypesToWatch = DruidNodeDiscoveryProvider . SERVICE_TO_NODE_TYPES . get ( service ) ; if ( nodeTypesToWatch == null ) { throw new IAE ( "Unknown service [%s]." , service ) ; } ServiceDruidNodeDiscovery serviceDiscovery = new ServiceDruidNodeDiscovery ( service , nodeTypesToWatch . size ( ) ) ; DruidNodeDiscovery . Listener filteringGatheringUpstreamListener = serviceDiscovery . filteringUpstreamListener ( ) ; for ( NodeType nodeType : nodeTypesToWatch ) { getForNodeType ( nodeType ) . registerListener ( filteringGatheringUpstreamListener ) ; } return serviceDiscovery ; } ) ; }
Get DruidNodeDiscovery instance to discover nodes that announce given service in its metadata .