diff --git a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AllocationDeciders.java b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AllocationDeciders.java index f6f43bd5c47c6..83d68724d0d0c 100644 --- a/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AllocationDeciders.java +++ b/server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/AllocationDeciders.java @@ -17,7 +17,6 @@ import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import java.util.Collection; -import java.util.Collections; /** * A composite {@link AllocationDecider} combining the "decision" of multiple @@ -27,10 +26,10 @@ public class AllocationDeciders extends AllocationDecider { private static final Logger logger = LogManager.getLogger(AllocationDeciders.class); - private final Collection allocations; + private final AllocationDecider[] allocations; public AllocationDeciders(Collection allocations) { - this.allocations = Collections.unmodifiableCollection(allocations); + this.allocations = allocations.toArray(AllocationDecider[]::new); } @Override @@ -265,7 +264,7 @@ public Decision canAllocateReplicaWhenThereIsRetentionLease(ShardRouting shardRo return ret; } - private void addDecision(Decision.Multi ret, Decision decision, RoutingAllocation allocation) { + private static void addDecision(Decision.Multi ret, Decision decision, RoutingAllocation allocation) { // We never add ALWAYS decisions and only add YES decisions when requested by debug mode (since Multi default is YES). if (decision != Decision.ALWAYS && (allocation.getDebugMode() == RoutingAllocation.DebugMode.ON || decision.type() != Decision.Type.YES)) {