diff --git a/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java b/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java index af49283f..10d36c0f 100644 --- a/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java +++ b/ribbon-loadbalancer/src/main/java/com/netflix/loadbalancer/BaseLoadBalancer.java @@ -674,9 +674,13 @@ public void runPinger() throws Exception { * going on... */ allLock = allServerLock.readLock(); + allLock.lock(); - allServers = allServerList.toArray(new Server[allServerList.size()]); - allLock.unlock(); + try { + allServers = allServerList.toArray(new Server[allServerList.size()]); + } finally { + allLock.unlock(); + } int numCandidates = allServers.length; results = pingerStrategy.pingServers(ping, allServers);