Commit e272f8d6 by Spencer Gibb

change caches to ConcurrentHashMap

parent acfecc38
package org.springframework.cloud.netflix.ribbon; package org.springframework.cloud.netflix.ribbon;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.netflix.loadbalancer.*; import com.netflix.loadbalancer.BaseLoadBalancer;
import com.netflix.loadbalancer.ILoadBalancer;
import com.netflix.loadbalancer.Server;
import com.netflix.loadbalancer.ServerStats;
import com.netflix.servo.monitor.Stopwatch; import com.netflix.servo.monitor.Stopwatch;
import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerRequest; import org.springframework.cloud.client.loadbalancer.LoadBalancerRequest;
import java.net.URI;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
/** /**
* @author Spencer Gibb * @author Spencer Gibb
* @author Dave Syer * @author Dave Syer
...@@ -23,8 +26,8 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient { ...@@ -23,8 +26,8 @@ public class RibbonLoadBalancerClient implements LoadBalancerClient {
private SpringClientFactory clientFactory; private SpringClientFactory clientFactory;
private Map<String, ILoadBalancer> balancers = new HashMap<>(); private Map<String, ILoadBalancer> balancers = new ConcurrentHashMap<>();
private Map<String, RibbonLoadBalancerContext> contexts = new HashMap<>(); private Map<String, RibbonLoadBalancerContext> contexts = new ConcurrentHashMap<>();
public RibbonLoadBalancerClient(RibbonClientPreprocessor ribbonClientPreprocessor, SpringClientFactory clientFactory, List<BaseLoadBalancer> balancers) { public RibbonLoadBalancerClient(RibbonClientPreprocessor ribbonClientPreprocessor, SpringClientFactory clientFactory, List<BaseLoadBalancer> balancers) {
this.ribbonClientPreprocessor = ribbonClientPreprocessor; this.ribbonClientPreprocessor = ribbonClientPreprocessor;
......
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