@Singleton public class DefaultLoadBalancerResolver extends java.lang.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,
java.util.List<ServiceInstanceList> serviceInstanceLists)
The default server loadbalance resolver.
|
DefaultLoadBalancerResolver(BeanContext beanContext,
ServiceInstanceList... serviceInstanceLists)
The default server loadbalance resolver.
|
Modifier and Type | Method and Description |
---|---|
java.util.Optional<? extends LoadBalancer> |
resolve(java.lang.String... serviceReferences)
Resolve a
LoadBalancer for the given references. |
protected java.util.Optional<? extends LoadBalancer> |
resolveLoadBalancerForServiceID(java.lang.String serviceID) |
public DefaultLoadBalancerResolver(BeanContext beanContext, ServiceInstanceList... serviceInstanceLists)
beanContext
- The bean contextserviceInstanceLists
- Any other providers@Inject public DefaultLoadBalancerResolver(BeanContext beanContext, java.util.List<ServiceInstanceList> serviceInstanceLists)
beanContext
- The bean contextserviceInstanceLists
- Any other providerspublic java.util.Optional<? extends LoadBalancer> resolve(java.lang.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 java.util.Optional<? extends LoadBalancer> resolveLoadBalancerForServiceID(java.lang.String serviceID)
serviceID
- The service IdOptional
with the load balancer