From e70420ef2b6e5fae3955d82e1dda598c5edb5216 Mon Sep 17 00:00:00 2001 From: jaymode Date: Mon, 25 Apr 2016 06:24:38 -0400 Subject: [PATCH] convert settings for ResourceWatcherService to new infrastructure This commit converts the settings for the ResourceWatcherService to use the new infrastructure and registers the settings so that they do not cause errors when used. --- .../common/settings/ClusterSettings.java | 7 ++++++- .../watcher/ResourceWatcherService.java | 19 ++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java b/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java index dc6e7c4dda1..55aa58ca588 100644 --- a/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java +++ b/core/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java @@ -94,6 +94,7 @@ import org.elasticsearch.transport.TransportService; import org.elasticsearch.transport.TransportSettings; import org.elasticsearch.transport.netty.NettyTransport; import org.elasticsearch.tribe.TribeService; +import org.elasticsearch.watcher.ResourceWatcherService; import java.util.Arrays; import java.util.Collections; @@ -411,6 +412,10 @@ public final class ClusterSettings extends AbstractScopedSettings { IndexingMemoryController.MIN_INDEX_BUFFER_SIZE_SETTING, IndexingMemoryController.MAX_INDEX_BUFFER_SIZE_SETTING, IndexingMemoryController.SHARD_INACTIVE_TIME_SETTING, - IndexingMemoryController.SHARD_MEMORY_INTERVAL_TIME_SETTING + IndexingMemoryController.SHARD_MEMORY_INTERVAL_TIME_SETTING, + ResourceWatcherService.ENABLED, + ResourceWatcherService.RELOAD_INTERVAL_HIGH, + ResourceWatcherService.RELOAD_INTERVAL_MEDIUM, + ResourceWatcherService.RELOAD_INTERVAL_LOW ))); } diff --git a/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java b/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java index 7c1cd060952..e66269484e0 100644 --- a/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java +++ b/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java @@ -20,6 +20,8 @@ package org.elasticsearch.watcher; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.settings.Setting; +import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.FutureUtils; @@ -64,6 +66,14 @@ public class ResourceWatcherService extends AbstractLifecycleComponent ENABLED = Setting.boolSetting("resource.reload.enabled", true, Property.NodeScope); + public static final Setting RELOAD_INTERVAL_HIGH = + Setting.timeSetting("resource.reload.interval.high", Frequency.HIGH.interval, Property.NodeScope); + public static final Setting RELOAD_INTERVAL_MEDIUM = Setting.timeSetting("resource.reload.interval.medium", + Setting.timeSetting("resource.reload.interval", Frequency.MEDIUM.interval), Property.NodeScope); + public static final Setting RELOAD_INTERVAL_LOW = + Setting.timeSetting("resource.reload.interval.low", Frequency.LOW.interval, Property.NodeScope); + private final boolean enabled; private final ThreadPool threadPool; @@ -78,15 +88,14 @@ public class ResourceWatcherService extends AbstractLifecycleComponent