mirror of https://github.com/grpc/grpc-java.git
util: Simplify MultiChildLB.getChildLbState()
Tests were converted to use getChildLbStateEag() if the argument was an EAG, so the instanceof was no longer necessary.
This commit is contained in:
parent
8c3496943c
commit
795e2cc3ff
|
|
@ -241,12 +241,6 @@ public abstract class MultiChildLoadBalancer extends LoadBalancer {
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public final ChildLbState getChildLbState(Object key) {
|
public final ChildLbState getChildLbState(Object key) {
|
||||||
if (key == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (key instanceof EquivalentAddressGroup) {
|
|
||||||
key = new Endpoint((EquivalentAddressGroup) key);
|
|
||||||
}
|
|
||||||
return childLbStates.get(key);
|
return childLbStates.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ public class LeastRequestLoadBalancerTest {
|
||||||
|
|
||||||
private LeastRequestLbState getChildLbState(PickResult pickResult) {
|
private LeastRequestLbState getChildLbState(PickResult pickResult) {
|
||||||
EquivalentAddressGroup eag = pickResult.getSubchannel().getAddresses();
|
EquivalentAddressGroup eag = pickResult.getSubchannel().getAddresses();
|
||||||
return (LeastRequestLbState) loadBalancer.getChildLbState(eag);
|
return (LeastRequestLbState) loadBalancer.getChildLbStateEag(eag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue