Skip to content

Commit

Permalink
util: Simplify MultiChildLB.getChildLbState()
Browse files Browse the repository at this point in the history
Tests were converted to use getChildLbStateEag() if the argument was an
EAG, so the instanceof was no longer necessary.
  • Loading branch information
ejona86 committed Sep 30, 2024
1 parent 8c34969 commit 795e2cc
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions util/src/main/java/io/grpc/util/MultiChildLoadBalancer.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,6 @@ public final Collection<ChildLbState> getChildLbStates() {

@VisibleForTesting
public final ChildLbState getChildLbState(Object key) {
if (key == null) {
return null;
}
if (key instanceof EquivalentAddressGroup) {
key = new Endpoint((EquivalentAddressGroup) key);
}
return childLbStates.get(key);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private List<Subchannel> getSubchannels(LeastRequestLoadBalancer lb) {

private LeastRequestLbState getChildLbState(PickResult pickResult) {
EquivalentAddressGroup eag = pickResult.getSubchannel().getAddresses();
return (LeastRequestLbState) loadBalancer.getChildLbState(eag);
return (LeastRequestLbState) loadBalancer.getChildLbStateEag(eag);
}

@Test
Expand Down

0 comments on commit 795e2cc

Please sign in to comment.