mirror of https://github.com/grpc/grpc-java.git
util: Remove MultiChildLB.getImmutableChildMap()
No usages actually needed a map nor a copy.
This commit is contained in:
parent
c120e364d2
commit
778a00b623
|
@ -26,7 +26,6 @@ import static io.grpc.ConnectivityState.TRANSIENT_FAILURE;
|
|||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.grpc.Attributes;
|
||||
import io.grpc.ConnectivityState;
|
||||
import io.grpc.EquivalentAddressGroup;
|
||||
|
@ -281,11 +280,6 @@ public abstract class MultiChildLoadBalancer extends LoadBalancer {
|
|||
return helper;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public final ImmutableMap<Object, ChildLbState> getImmutableChildMap() {
|
||||
return ImmutableMap.copyOf(childLbStates);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public final Collection<ChildLbState> getChildLbStates() {
|
||||
return childLbStates.values();
|
||||
|
|
|
@ -27,7 +27,6 @@ import static io.grpc.ConnectivityState.TRANSIENT_FAILURE;
|
|||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.collect.HashMultiset;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Multiset;
|
||||
import com.google.common.primitives.UnsignedInteger;
|
||||
import io.grpc.Attributes;
|
||||
|
@ -42,6 +41,7 @@ import io.grpc.xds.client.XdsLogger;
|
|||
import io.grpc.xds.client.XdsLogger.XdsLogLevel;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -213,7 +213,7 @@ final class RingHashLoadBalancer extends MultiChildLoadBalancer {
|
|||
overallState = TRANSIENT_FAILURE;
|
||||
}
|
||||
|
||||
RingHashPicker picker = new RingHashPicker(syncContext, ring, getImmutableChildMap());
|
||||
RingHashPicker picker = new RingHashPicker(syncContext, ring, getChildLbStates());
|
||||
getHelper().updateBalancingState(overallState, picker);
|
||||
this.currentConnectivityState = overallState;
|
||||
}
|
||||
|
@ -345,13 +345,12 @@ final class RingHashLoadBalancer extends MultiChildLoadBalancer {
|
|||
|
||||
private RingHashPicker(
|
||||
SynchronizationContext syncContext, List<RingEntry> ring,
|
||||
ImmutableMap<Object, ChildLbState> subchannels) {
|
||||
Collection<ChildLbState> children) {
|
||||
this.syncContext = syncContext;
|
||||
this.ring = ring;
|
||||
pickableSubchannels = new HashMap<>(subchannels.size());
|
||||
for (Map.Entry<Object, ChildLbState> entry : subchannels.entrySet()) {
|
||||
ChildLbState childLbState = entry.getValue();
|
||||
pickableSubchannels.put((Endpoint)entry.getKey(),
|
||||
pickableSubchannels = new HashMap<>(children.size());
|
||||
for (ChildLbState childLbState : children) {
|
||||
pickableSubchannels.put((Endpoint)childLbState.getKey(),
|
||||
new SubchannelView(childLbState, childLbState.getCurrentState()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue