private void populateServiceMap(final String serviceName,
                                    final List<EndpointDefinition> healthyServices) {

        final ServicePool servicePool = servicePool(serviceName);

        /* If there were changes then send a service pool change event on the event channel. */
        if (servicePool.setHealthyNodes(healthyServices)) {
            serviceChangedEventChannel.servicePoolChanged(serviceName);
            serviceChangedEventChannel.flushEvents();
        }

        final BlockingQueue<Callback<List<EndpointDefinition>>> callbacks = callbackMap.get(serviceName);

        if (callbacks != null) {
            Callback<List<EndpointDefinition>> callback = callbacks.poll();
            while (callback != null) {
                callback.resolve(healthyServices);
                callback = callbacks.poll();
            }
        }
    }
private void populateServiceMap(final String serviceName,
                                    final List<EndpointDefinition> healthyServices) {

        final ServicePool servicePool = servicePool(serviceName);

        
        if (servicePool.setHealthyNodes(healthyServices)) {
            serviceChangedEventChannel.servicePoolChanged(serviceName);
            serviceChangedEventChannel.flushEvents();
        }

        final BlockingQueue<Callback<List<EndpointDefinition>>> callbacks = callbackMap.get(serviceName);

        if (callbacks != null) {
            Callback<List<EndpointDefinition>> callback = callbacks.poll();
            while (callback != null) {
                callback.resolve(healthyServices);
                callback = callbacks.poll();
            }
        }
    }
private void populateServiceMap ( final String serviceName , final List < EndpointDefinition > healthyServices ) { final ServicePool servicePool = servicePool ( serviceName ) ; /* If there were changes then send a service pool change event on the event channel. */ if ( servicePool . setHealthyNodes ( healthyServices ) ) { serviceChangedEventChannel . servicePoolChanged ( serviceName ) ; serviceChangedEventChannel . flushEvents ( ) ; } final BlockingQueue < Callback < List < EndpointDefinition > > > callbacks = callbackMap . get ( serviceName ) ; if ( callbacks != null ) { Callback < List < EndpointDefinition >> callback = callbacks . poll ( ) ; while ( callback != null ) { callback . resolve ( healthyServices ) ; callback = callbacks . poll ( ) ; } } }
Populate the service map.
Look up the service pool.
Apply the healthy services so the pool can see if there were changes (additions, removal, etc.)

@param serviceName     service name
@param healthyServices list of healthy services that we just loaded.
Populate the service map . Look up the service pool . Apply the healthy services so the pool can see if there were changes ( additions removal etc . )