|
26 | 26 | import com.google.common.annotations.VisibleForTesting;
|
27 | 27 | import java.io.IOException;
|
28 | 28 | import java.util.ArrayList;
|
29 |
| -import java.util.Collections; |
30 | 29 | import java.util.HashMap;
|
31 | 30 | import java.util.List;
|
32 | 31 | import java.util.Map;
|
@@ -381,19 +380,19 @@ public CompletableFuture<Optional<BrokerLookupData>> assign(Optional<ServiceUnit
|
381 | 380 | }
|
382 | 381 |
|
383 | 382 | public CompletableFuture<Optional<String>> selectAsync(ServiceUnitId bundle) {
|
384 |
| - return selectAsync(bundle, Collections.emptySet()); |
| 383 | + return selectAsync(bundle, Optional.empty()); |
385 | 384 | }
|
386 | 385 |
|
387 | 386 | public CompletableFuture<Optional<String>> selectAsync(ServiceUnitId bundle,
|
388 |
| - Set<String> excludeBrokerSet) { |
| 387 | + Optional<Set<String>> excludeBrokerSet) { |
389 | 388 | BrokerRegistry brokerRegistry = getBrokerRegistry();
|
390 | 389 | return brokerRegistry.getAvailableBrokerLookupDataAsync()
|
391 | 390 | .thenCompose(availableBrokers -> {
|
392 | 391 | LoadManagerContext context = this.getContext();
|
393 | 392 |
|
394 | 393 | Map<String, BrokerLookupData> availableBrokerCandidates = new HashMap<>(availableBrokers);
|
395 |
| - if (!excludeBrokerSet.isEmpty()) { |
396 |
| - for (String exclude : excludeBrokerSet) { |
| 394 | + if (excludeBrokerSet.isPresent()) { |
| 395 | + for (String exclude : excludeBrokerSet.get()) { |
397 | 396 | availableBrokerCandidates.remove(exclude);
|
398 | 397 | }
|
399 | 398 | }
|
|
0 commit comments