From 795e2cc3ff25666b5c7d8beed985dbd55fc40804 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Sat, 31 Aug 2024 17:53:01 -0700 Subject: [PATCH] util: Simplify MultiChildLB.getChildLbState() Tests were converted to use getChildLbStateEag() if the argument was an EAG, so the instanceof was no longer necessary. --- util/src/main/java/io/grpc/util/MultiChildLoadBalancer.java | 6 ------ .../test/java/io/grpc/xds/LeastRequestLoadBalancerTest.java | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/util/src/main/java/io/grpc/util/MultiChildLoadBalancer.java b/util/src/main/java/io/grpc/util/MultiChildLoadBalancer.java index b05f4d98c85..330ec9d5357 100644 --- a/util/src/main/java/io/grpc/util/MultiChildLoadBalancer.java +++ b/util/src/main/java/io/grpc/util/MultiChildLoadBalancer.java @@ -241,12 +241,6 @@ public final Collection 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); } diff --git a/xds/src/test/java/io/grpc/xds/LeastRequestLoadBalancerTest.java b/xds/src/test/java/io/grpc/xds/LeastRequestLoadBalancerTest.java index 659bacd3626..64e18465597 100644 --- a/xds/src/test/java/io/grpc/xds/LeastRequestLoadBalancerTest.java +++ b/xds/src/test/java/io/grpc/xds/LeastRequestLoadBalancerTest.java @@ -252,7 +252,7 @@ private List getSubchannels(LeastRequestLoadBalancer lb) { private LeastRequestLbState getChildLbState(PickResult pickResult) { EquivalentAddressGroup eag = pickResult.getSubchannel().getAddresses(); - return (LeastRequestLbState) loadBalancer.getChildLbState(eag); + return (LeastRequestLbState) loadBalancer.getChildLbStateEag(eag); } @Test