diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java index 945f76fec13d4..7f3d811470c22 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java @@ -12,8 +12,6 @@ import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.support.DefaultShardOperationFailedException; import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.collect.ImmutableOpenIntMap; -import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; @@ -241,19 +239,15 @@ public IndicesShardStoresResponse(Map>> s } IndicesShardStoresResponse() { - this(ImmutableOpenMap.of(), Collections.emptyList()); + this(Map.of(), Collections.emptyList()); } public IndicesShardStoresResponse(StreamInput in) throws IOException { super(in); - storeStatuses = in.readImmutableOpenMap(StreamInput::readString, i -> { - int indexEntries = i.readVInt(); - ImmutableOpenIntMap.Builder> shardEntries = ImmutableOpenIntMap.builder(); - for (int shardCount = 0; shardCount < indexEntries; shardCount++) { - shardEntries.put(i.readInt(), i.readList(StoreStatus::new)); - } - return shardEntries.build(); - }); + storeStatuses = in.readImmutableMap( + StreamInput::readString, + i -> i.readImmutableMap(StreamInput::readInt, j -> j.readImmutableList(StoreStatus::new)) + ); failures = Collections.unmodifiableList(in.readList(Failure::readFailure)); }