mirror of https://github.com/grpc/grpc-java.git
core: Avoid exception handling in PF for invalid index
It is trivial to avoid the exception from addressIndex.getCurrentAddress(). The log message was inaccurate, as the subchannel might have been TRANSIENT_FAILURE. The only important part of the condition was whether the subchannel was the current subchannel.
This commit is contained in:
parent
33687d3983
commit
4914ffc59a
|
@ -482,12 +482,9 @@ final class PickFirstLeafLoadBalancer extends LoadBalancer {
|
|||
log.log(Level.FINE, "Received health status {0} for subchannel {1}",
|
||||
new Object[]{newState, subchannelData.subchannel});
|
||||
subchannelData.healthStateInfo = newState;
|
||||
try {
|
||||
if (subchannelData == subchannels.get(addressIndex.getCurrentAddress())) {
|
||||
updateHealthCheckedState(subchannelData);
|
||||
}
|
||||
} catch (IllegalStateException e) {
|
||||
log.fine("Health listener received state change after subchannel was removed");
|
||||
if (addressIndex.isValid()
|
||||
&& subchannelData == subchannels.get(addressIndex.getCurrentAddress())) {
|
||||
updateHealthCheckedState(subchannelData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue