diff --git a/core/src/main/java/org/elasticsearch/common/component/AbstractComponent.java b/core/src/main/java/org/elasticsearch/common/component/AbstractComponent.java index a31bf119402..bed1f06676a 100644 --- a/core/src/main/java/org/elasticsearch/common/component/AbstractComponent.java +++ b/core/src/main/java/org/elasticsearch/common/component/AbstractComponent.java @@ -19,6 +19,7 @@ package org.elasticsearch.common.component; +import com.google.common.base.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.logging.ESLogger; import org.elasticsearch.common.logging.Loggers; @@ -51,4 +52,22 @@ public abstract class AbstractComponent { public final String nodeName() { return settings.get("name", ""); } + + /** + * Checks for a deprecated setting and logs the correct alternative + */ + protected void logDeprecatedSetting(String settingName, String alternativeName) { + if (!Strings.isNullOrEmpty(settings.get(settingName))) { + deprecationLogger.deprecated("Setting [{}] is deprecated, use [{}] instead", settingName, alternativeName); + } + } + + /** + * Checks for a removed setting and logs the correct alternative + */ + protected void logRemovedSetting(String settingName, String alternativeName) { + if (!Strings.isNullOrEmpty(settings.get(settingName))) { + deprecationLogger.deprecated("Setting [{}] has been removed, use [{}] instead", settingName, alternativeName); + } + } } diff --git a/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java b/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java index ebb5bb84623..4719bd997d7 100644 --- a/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java +++ b/core/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java @@ -35,12 +35,12 @@ import java.util.concurrent.ScheduledFuture; * * Other elasticsearch services can register their resource watchers with this service using {@link #add(ResourceWatcher)} * method. This service will call {@link org.elasticsearch.watcher.ResourceWatcher#checkAndNotify()} method of all - * registered watcher periodically. The frequency of checks can be specified using {@code watcher.interval} setting, which - * defaults to {@code 60s}. The service can be disabled by setting {@code watcher.enabled} setting to {@code false}. + * registered watcher periodically. The frequency of checks can be specified using {@code resource.reload.interval} setting, which + * defaults to {@code 60s}. The service can be disabled by setting {@code resource.reload.enabled} setting to {@code false}. */ public class ResourceWatcherService extends AbstractLifecycleComponent { - public static enum Frequency { + public enum Frequency { /** * Defaults to 5 seconds @@ -59,7 +59,7 @@ public class ResourceWatcherService extends AbstractLifecycleComponent