use of org.opensearch.cluster.routing.allocation.ExistingShardsAllocator in project OpenSearch by opensearch-project.
the class ClusterModule method setExistingShardsAllocators.
public void setExistingShardsAllocators(GatewayAllocator gatewayAllocator) {
final Map<String, ExistingShardsAllocator> existingShardsAllocators = new HashMap<>();
existingShardsAllocators.put(GatewayAllocator.ALLOCATOR_NAME, gatewayAllocator);
for (ClusterPlugin clusterPlugin : clusterPlugins) {
for (Map.Entry<String, ExistingShardsAllocator> existingShardsAllocatorEntry : clusterPlugin.getExistingShardsAllocators().entrySet()) {
final String allocatorName = existingShardsAllocatorEntry.getKey();
if (existingShardsAllocators.put(allocatorName, existingShardsAllocatorEntry.getValue()) != null) {
throw new IllegalArgumentException("ExistingShardsAllocator [" + allocatorName + "] from [" + clusterPlugin.getClass().getName() + "] was already defined");
}
}
}
allocationService.setExistingShardsAllocators(existingShardsAllocators);
}
Aggregations