Search in sources :

Example 1 with ExistingShardsAllocator

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);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ClusterPlugin(org.opensearch.plugins.ClusterPlugin) ExistingShardsAllocator(org.opensearch.cluster.routing.allocation.ExistingShardsAllocator) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ExistingShardsAllocator (org.opensearch.cluster.routing.allocation.ExistingShardsAllocator)1 ClusterPlugin (org.opensearch.plugins.ClusterPlugin)1