From ff147835ef35b85918855ba286489a9d26055e4f Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 4 Oct 2018 16:03:22 -0400 Subject: [PATCH 1/2] Core: Remove two methods from AbstractComponent This removes another two methods from `AbstractComponent`. One isn't used at all and another is only used in a single class in watcher. I've moved the method that watcher uses into the single class that uses it. --- .../common/component/AbstractComponent.java | 20 ------------------- .../watcher/ResourceWatcherService.java | 10 ++++++++++ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/common/component/AbstractComponent.java b/server/src/main/java/org/elasticsearch/common/component/AbstractComponent.java index 167ffdb7bea25..97a8053c1d912 100644 --- a/server/src/main/java/org/elasticsearch/common/component/AbstractComponent.java +++ b/server/src/main/java/org/elasticsearch/common/component/AbstractComponent.java @@ -21,7 +21,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.Node; @@ -44,23 +43,4 @@ public AbstractComponent(Settings settings) { public final String nodeName() { return Node.NODE_NAME_SETTING.get(settings); } - - /** - * 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/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java b/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java index 54b24a86cc385..b777cc7517163 100644 --- a/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java +++ b/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java @@ -18,6 +18,7 @@ */ package org.elasticsearch.watcher; +import org.elasticsearch.common.Strings; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Setting; @@ -201,4 +202,13 @@ public synchronized void run() { } } } + + /** + * Checks for a removed setting and logs the correct alternative + */ + private void logRemovedSetting(String settingName, String alternativeName) { + if (!Strings.isNullOrEmpty(settings.get(settingName))) { + deprecationLogger.deprecated("Setting [{}] has been removed, use [{}] instead", settingName, alternativeName); + } + } } From bf44e7378578f975edd61d7a3d2851e7ca5ba048 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 10 Oct 2018 06:20:21 -0400 Subject: [PATCH 2/2] Remove entirely --- .../watcher/ResourceWatcherService.java | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java b/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java index b777cc7517163..997f7e845e287 100644 --- a/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java +++ b/server/src/main/java/org/elasticsearch/watcher/ResourceWatcherService.java @@ -18,7 +18,6 @@ */ package org.elasticsearch.watcher; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Setting; @@ -98,12 +97,6 @@ public ResourceWatcherService(Settings settings, ThreadPool threadPool) { mediumMonitor = new ResourceMonitor(interval, Frequency.MEDIUM); interval = RELOAD_INTERVAL_HIGH.get(settings); highMonitor = new ResourceMonitor(interval, Frequency.HIGH); - - logRemovedSetting("watcher.enabled", "resource.reload.enabled"); - logRemovedSetting("watcher.interval", "resource.reload.interval"); - logRemovedSetting("watcher.interval.low", "resource.reload.interval.low"); - logRemovedSetting("watcher.interval.medium", "resource.reload.interval.medium"); - logRemovedSetting("watcher.interval.high", "resource.reload.interval.high"); } @Override @@ -202,13 +195,4 @@ public synchronized void run() { } } } - - /** - * Checks for a removed setting and logs the correct alternative - */ - private void logRemovedSetting(String settingName, String alternativeName) { - if (!Strings.isNullOrEmpty(settings.get(settingName))) { - deprecationLogger.deprecated("Setting [{}] has been removed, use [{}] instead", settingName, alternativeName); - } - } }