Commit aa862673 by Spencer Gibb

Introduce Ribbon ServerIntrospector.

Allows ribbon load balancer implementations to answer questions like isSecure(Server).
parent 3ed982d2
......@@ -105,15 +105,11 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
if (config != null) {
return config.get(CommonClientConfigKey.IsSecure, false);
}
if (ClassUtils.isPresent("com.netflix.niws.loadbalancer.DiscoveryEnabledServer",
null)) {
if (server instanceof DiscoveryEnabledServer) {
DiscoveryEnabledServer enabled = (DiscoveryEnabledServer) server;
return enabled.getInstanceInfo().isPortEnabled(PortType.SECURE);
ServerIntrospector serverIntrospector = clientFactory.getInstance(serviceId, ServerIntrospector.class);
if (serverIntrospector == null) {
serverIntrospector = new DefaultServerIntrospector();
}
}
// Can we do better?
return ("" + server.getPort()).endsWith("443");
return serverIntrospector.isSecure(server);
}
private void recordStats(RibbonLoadBalancerContext context, Stopwatch tracer,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment