settings.put(BalancedShardsAllocator.SETTING_INDEX_BALANCE_FACTOR, 0.2);
settings.put(BalancedShardsAllocator.SETTING_SHARD_BALANCE_FACTOR, 0.3);
settings.put(BalancedShardsAllocator.SETTING_PRIMARY_BALANCE_FACTOR, 0.5);
settings.put(BalancedShardsAllocator.SETTING_THRESHOLD, 2.0);
final NodeSettingsService.Listener[] listeners = new NodeSettingsService.Listener[1];
NodeSettingsService service = new NodeSettingsService(settingsBuilder().build()) {
@Override
public void addListener(Listener listener) {
assertNull("addListener was called twice while only one time was expected", listeners[0]);
listeners[0] = listener;