@Singleton public class DefaultLoadBalancerResolver extends Object implements LoadBalancerResolver
Abstraction over LoadBalancer
lookup. The strategy is as follows:
EmbeddedServer
DiscoveryClient
to attempt to resolve the URIsConstructor and Description |
---|
DefaultLoadBalancerResolver(BeanContext beanContext,
List<ServiceInstanceList> serviceInstanceLists)
The default server loadbalance resolver.
|
DefaultLoadBalancerResolver(BeanContext beanContext,
ServiceInstanceList... serviceInstanceLists)
The default server loadbalance resolver.
|
Modifier and Type | Method and Description |
---|---|
Optional<? extends LoadBalancer> |
resolve(String... serviceReferences)
Resolve a
LoadBalancer for the given references. |
protected Optional<? extends LoadBalancer> |
resolveLoadBalancerForServiceID(String serviceID) |
public DefaultLoadBalancerResolver(BeanContext beanContext, ServiceInstanceList... serviceInstanceLists)
beanContext
- The bean contextserviceInstanceLists
- Any other providers@Inject public DefaultLoadBalancerResolver(BeanContext beanContext, List<ServiceInstanceList> serviceInstanceLists)
beanContext
- The bean contextserviceInstanceLists
- Any other providerspublic Optional<? extends LoadBalancer> resolve(String... serviceReferences)
LoadBalancerResolver
LoadBalancer
for the given references.resolve
in interface LoadBalancerResolver
serviceReferences
- The references. These could be service IDs or fully HTTP URLsLoadBalancer
or empty of non can be resolvedprotected Optional<? extends LoadBalancer> resolveLoadBalancerForServiceID(String serviceID)
serviceID
- The service IdOptional
with the load balancer