|
27 | 27 |
|
28 | 28 | import com.google.common.base.MoreObjects; |
29 | 29 | import com.google.common.collect.HashMultiset; |
30 | | -import com.google.common.collect.ImmutableMap; |
31 | 30 | import com.google.common.collect.Multiset; |
32 | 31 | import com.google.common.primitives.UnsignedInteger; |
33 | 32 | import io.grpc.Attributes; |
|
42 | 41 | import io.grpc.xds.client.XdsLogger.XdsLogLevel; |
43 | 42 | import java.net.SocketAddress; |
44 | 43 | import java.util.ArrayList; |
| 44 | +import java.util.Collection; |
45 | 45 | import java.util.Collections; |
46 | 46 | import java.util.HashMap; |
47 | 47 | import java.util.HashSet; |
@@ -213,7 +213,7 @@ protected void updateOverallBalancingState() { |
213 | 213 | overallState = TRANSIENT_FAILURE; |
214 | 214 | } |
215 | 215 |
|
216 | | - RingHashPicker picker = new RingHashPicker(syncContext, ring, getImmutableChildMap()); |
| 216 | + RingHashPicker picker = new RingHashPicker(syncContext, ring, getChildLbStates()); |
217 | 217 | getHelper().updateBalancingState(overallState, picker); |
218 | 218 | this.currentConnectivityState = overallState; |
219 | 219 | } |
@@ -345,13 +345,12 @@ private static final class RingHashPicker extends SubchannelPicker { |
345 | 345 |
|
346 | 346 | private RingHashPicker( |
347 | 347 | SynchronizationContext syncContext, List<RingEntry> ring, |
348 | | - ImmutableMap<Object, ChildLbState> subchannels) { |
| 348 | + Collection<ChildLbState> children) { |
349 | 349 | this.syncContext = syncContext; |
350 | 350 | this.ring = ring; |
351 | | - pickableSubchannels = new HashMap<>(subchannels.size()); |
352 | | - for (Map.Entry<Object, ChildLbState> entry : subchannels.entrySet()) { |
353 | | - ChildLbState childLbState = entry.getValue(); |
354 | | - pickableSubchannels.put((Endpoint)entry.getKey(), |
| 351 | + pickableSubchannels = new HashMap<>(children.size()); |
| 352 | + for (ChildLbState childLbState : children) { |
| 353 | + pickableSubchannels.put((Endpoint)childLbState.getKey(), |
355 | 354 | new SubchannelView(childLbState, childLbState.getCurrentState())); |
356 | 355 | } |
357 | 356 | } |
|
0 commit comments