lennonchan opened a new issue, #3818:
URL: https://github.com/apache/servicecomb-java-chassis/issues/3818
ServiceCombServer 类的equals方法在预期类型的情况下,只判断instanceId是否相等。
```
public boolean equals(Object o) {
if (o instanceof ServiceCombServer) {
return this.instance.getInstanceId().equals(((ServiceCombServer)
o).instance.getInstanceId());
} else {
return false;
}
}
```
在一个服务实例有多个类型的监听时,如同时启动rest和highway,切highway故障的情况下,第一次尝试highway通信失败,在尝试使用rest通信时因为两个ServiceCombServer对象equals判断时返回成功,导致不会尝试rest通信。
```
public Server chooseServer(Object key) {
Invocation invocation = (Invocation) key;
boolean isRetry = null != lastServer;
for (int i = 0; i < COUNT; i++) {
Server s = delegate.chooseServer(invocation);
if (s == null) {
break;
}
if (!s.equals(lastServer)) { // lastServer为highway对应的Server,s
为rest对应的场景,因为s.equals(lastServer) == true,导致lb不尝试使用s通信
lastServer = s;
break;
}
}
if (isRetry) {
invocation.getTraceIdLogger().info(LOGGER, "retry to instance [{}]",
lastServer.getHostPort());
}
return lastServer;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]