allow to dynamically set cluster.routing.allocation.cluster_concurrent_rebalance using cluster update settings API

This commit is contained in:
Shay Banon 2011-09-25 21:09:41 +03:00
parent e8b88acbd3
commit fca3adcd59
1 changed files with 2 additions and 1 deletions

View File

@ -49,10 +49,11 @@ public class ConcurrentRebalanceAllocationDecider extends AllocationDecider {
private volatile int clusterConcurrentRebalance; private volatile int clusterConcurrentRebalance;
@Inject public ConcurrentRebalanceAllocationDecider(Settings settings) { @Inject public ConcurrentRebalanceAllocationDecider(Settings settings, NodeSettingsService nodeSettingsService) {
super(settings); super(settings);
this.clusterConcurrentRebalance = settings.getAsInt("cluster.routing.allocation.cluster_concurrent_rebalance", 2); this.clusterConcurrentRebalance = settings.getAsInt("cluster.routing.allocation.cluster_concurrent_rebalance", 2);
logger.debug("using [cluster_concurrent_rebalance] with [{}]", clusterConcurrentRebalance); logger.debug("using [cluster_concurrent_rebalance] with [{}]", clusterConcurrentRebalance);
nodeSettingsService.addListener(new ApplySettings());
} }
@Override public boolean canRebalance(ShardRouting shardRouting, RoutingAllocation allocation) { @Override public boolean canRebalance(ShardRouting shardRouting, RoutingAllocation allocation) {