protected Optional<? extends LoadBalancer> resolveLoadBalancerForServiceID(String serviceID) {
        if (serviceInstanceLists.containsKey(serviceID)) {
            ServiceInstanceList serviceInstanceList = serviceInstanceLists.get(serviceID);
            LoadBalancer loadBalancer = beanContext.getBean(ServiceInstanceListLoadBalancerFactory.class).create(serviceInstanceList);
            return Optional.ofNullable(loadBalancer);
        } else {
            LoadBalancer loadBalancer = beanContext.getBean(DiscoveryClientLoadBalancerFactory.class).create(serviceID);
            return Optional.of(loadBalancer);
        }
    }
protected Optional < ? extends LoadBalancer > resolveLoadBalancerForServiceID ( String serviceID ) { if ( serviceInstanceLists . containsKey ( serviceID ) ) { ServiceInstanceList serviceInstanceList = serviceInstanceLists . get ( serviceID ) ; LoadBalancer loadBalancer = beanContext . getBean ( ServiceInstanceListLoadBalancerFactory . class ) . create ( serviceInstanceList ) ; return Optional . ofNullable ( loadBalancer ) ; } else { LoadBalancer loadBalancer = beanContext . getBean ( DiscoveryClientLoadBalancerFactory . class ) . create ( serviceID ) ; return Optional . of ( loadBalancer ) ; } }
@param serviceID The service Id
@return An {@link Optional} with the load balancer