diff --git a/helix-core/src/main/java/org/apache/helix/model/ResourceConfig.java b/helix-core/src/main/java/org/apache/helix/model/ResourceConfig.java index 69aa533fdc..1c38a3b66b 100644 --- a/helix-core/src/main/java/org/apache/helix/model/ResourceConfig.java +++ b/helix-core/src/main/java/org/apache/helix/model/ResourceConfig.java @@ -28,6 +28,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableMap; import org.apache.helix.HelixProperty; import org.apache.helix.api.config.HelixConfigProperty; import org.apache.helix.api.config.RebalanceConfig; @@ -448,7 +449,7 @@ public void setPartitionCapacityMap(Map> partitionC String.format("Capacity Data contains a negative value:%s", capacities.toString())); } newCapacityRecord.put(partition, _objectMapper.writeValueAsString(capacities)); - newDeserializedPartitionCapacityMap.put(partition, Map.copyOf(capacities)); + newDeserializedPartitionCapacityMap.put(partition, ImmutableMap.copyOf(capacities)); } _record.setMapField(ResourceConfigProperty.PARTITION_CAPACITY_MAP.name(), newCapacityRecord); diff --git a/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java b/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java index 45701063c5..5b2210b720 100644 --- a/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java +++ b/meta-client/src/main/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientCache.java @@ -19,6 +19,7 @@ * under the License. */ +import com.google.common.collect.ImmutableList; import org.apache.helix.metaclient.api.ChildChangeListener; import org.apache.helix.metaclient.api.MetaClientCacheInterface; import org.apache.helix.metaclient.exception.MetaClientException; @@ -118,7 +119,7 @@ public List getDirectChildrenKeys(final String key) { LOG.debug("Children not found in cache for key: {}. This could be because the cache is still being populated.", key); return null; } - return List.copyOf(node.getChildren().keySet()); + return ImmutableList.copyOf(node.getChildren().keySet()); } return super.getDirectChildrenKeys(key); }