From 87009ee409878a901ca5b681cc9114274d17ee57 Mon Sep 17 00:00:00 2001 From: Zixuan Liu Date: Thu, 15 Aug 2024 10:53:21 +0800 Subject: [PATCH] [fix][build] BookieRackAffinityMapping compile Signed-off-by: Zixuan Liu --- .../bookie/rackawareness/BookieRackAffinityMapping.java | 5 ++--- .../bookie/rackawareness/BookieRackAffinityMappingTest.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java index 0ba4f5080e606..bfb47ff50acb8 100644 --- a/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java +++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java @@ -124,11 +124,10 @@ public synchronized void setConf(Configuration conf) { store.registerListener(this::handleUpdates); try { - var racksWithHost = bookieMappingCache.get(BOOKIE_INFO_ROOT_PATH) + BookiesRackConfiguration racksWithHost = bookieMappingCache.get(BOOKIE_INFO_ROOT_PATH) .thenApply(optRes -> optRes.orElseGet(BookiesRackConfiguration::new)) .get(); - - for (var bookieMapping : racksWithHost.values()) { + for (Map bookieMapping : racksWithHost.values()) { for (String address : bookieMapping.keySet()) { bookieAddressListLastTime.add(BookieId.parse(address)); } diff --git a/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMappingTest.java b/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMappingTest.java index cce50f9e5305c..7e43df9653001 100644 --- a/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMappingTest.java +++ b/pulsar-broker-common/src/test/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMappingTest.java @@ -348,7 +348,7 @@ public void testWithPulsarRegistrationClient() throws Exception { racks = mapping .resolve(Lists.newArrayList(BOOKIE1.getHostName(), BOOKIE2.getHostName(), BOOKIE3.getHostName())) - .stream().filter(Objects::nonNull).toList(); + .stream().filter(Objects::nonNull).collect(Collectors.toList()); assertEquals(racks.size(), 1); assertEquals(racks.get(0), "/rack0"); assertEquals(knownBookies.size(), 3);