Skip to content

Commit 3ea4c04

Browse files
committed
判断list是否为空
1 parent a5413f5 commit 3ea4c04

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

transaction-springcloud/src/main/java/com/codingapi/ribbon/loadbalancer/LcnZoneAwareLoadBalancerProxy.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import org.slf4j.Logger;
66
import org.slf4j.LoggerFactory;
77

8-
import java.util.ArrayList;
98
import java.util.List;
109

1110
/**
@@ -27,7 +26,7 @@ public LcnZoneAwareLoadBalancerProxy(IClientConfig clientConfig, IRule rule,
2726
public Server chooseServer(Object key){
2827
logger.info("enter chooseServer method, key:" + key);
2928
List<Server> serverList = super.getReachableServers();
30-
if(serverList.size() <= 0){
29+
if(null == serverList || serverList.isEmpty()){
3130
return super.chooseServer(key);
3231
}
3332
return lcnLoadBalancerRule.proxy(serverList, super.chooseServer(key));

0 commit comments

Comments
 (0)