From 37214c4dea148cd1a0491cf2a76ce305c46e18b3 Mon Sep 17 00:00:00 2001 From: jaymode Date: Thu, 8 Nov 2018 15:18:23 -0700 Subject: [PATCH] Remove use of AbstractComponent in xpack This commit removes the use of AbstractComponent in xpack where it was still being extended. It has been replaced with explicit logger declarations. See #34488 --- .../elasticsearch/xpack/ml/InvalidLicenseEnforcer.java | 7 +++++-- .../elasticsearch/xpack/ml/MlAssignmentNotifier.java | 7 +++++-- .../xpack/ml/MlInitializationService.java | 3 +-- .../org/elasticsearch/xpack/ml/MlLifeCycleService.java | 3 +-- .../xpack/ml/datafeed/DatafeedManager.java | 7 +++++-- .../org/elasticsearch/xpack/ml/job/JobManager.java | 10 ++++------ .../ml/job/persistence/JobDataCountsPersister.java | 7 +++++-- .../persistence/JobRenormalizedResultsPersister.java | 7 +++++-- .../xpack/ml/job/persistence/JobResultsPersister.java | 7 +++++-- .../xpack/ml/job/process/DataCountsReporter.java | 7 +++++-- .../process/autodetect/AutodetectProcessManager.java | 9 +++++---- .../autodetect/output/AutodetectResultsParser.java | 9 ++++++--- .../xpack/monitoring/collector/Collector.java | 7 +++++-- .../elasticsearch/xpack/upgrade/IndexUpgradeCheck.java | 3 +-- .../xpack/upgrade/IndexUpgradeService.java | 7 +++++-- .../xpack/watcher/WatcherIndexingListener.java | 7 +++++-- .../xpack/watcher/WatcherLifeCycleService.java | 3 +-- .../elasticsearch/xpack/watcher/WatcherService.java | 6 ++++-- .../xpack/watcher/common/http/HttpClient.java | 6 ++++-- .../xpack/watcher/execution/ExecutionService.java | 7 +++++-- .../xpack/watcher/execution/TriggeredWatchStore.java | 7 +++++-- .../xpack/watcher/history/HistoryStore.java | 7 +++++-- .../watcher/notification/NotificationService.java | 3 +-- .../xpack/watcher/notification/email/EmailService.java | 4 ++++ .../watcher/notification/hipchat/HipChatService.java | 3 +++ .../xpack/watcher/notification/slack/SlackService.java | 4 ++++ .../watcher/support/WatcherIndexTemplateRegistry.java | 7 +++++-- .../support/search/WatcherSearchTemplateService.java | 3 +-- .../xpack/watcher/trigger/TriggerService.java | 3 +-- .../trigger/schedule/ScheduleTriggerEngine.java | 3 +-- .../schedule/engine/TickerScheduleTriggerEngine.java | 4 ++++ .../elasticsearch/xpack/watcher/watch/WatchParser.java | 7 +++++-- .../example/role/CustomInMemoryRolesProvider.java | 5 +---- 33 files changed, 122 insertions(+), 67 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/InvalidLicenseEnforcer.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/InvalidLicenseEnforcer.java index 21e06362a70a3..35ec721a94710 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/InvalidLicenseEnforcer.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/InvalidLicenseEnforcer.java @@ -5,14 +5,17 @@ */ package org.elasticsearch.xpack.ml; -import org.elasticsearch.common.component.AbstractComponent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.ml.datafeed.DatafeedManager; import org.elasticsearch.xpack.ml.job.process.autodetect.AutodetectProcessManager; -public class InvalidLicenseEnforcer extends AbstractComponent { +public class InvalidLicenseEnforcer { + + private static final Logger logger = LogManager.getLogger(InvalidLicenseEnforcer.class); private final ThreadPool threadPool; private final XPackLicenseState licenseState; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAssignmentNotifier.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAssignmentNotifier.java index 1bd4157ed48b4..befef244c7dfb 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAssignmentNotifier.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlAssignmentNotifier.java @@ -5,12 +5,13 @@ */ package org.elasticsearch.xpack.ml; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterStateListener; import org.elasticsearch.cluster.LocalNodeMasterListener; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.xpack.core.ml.MlMetadata; import org.elasticsearch.xpack.core.ml.action.OpenJobAction; @@ -24,7 +25,9 @@ import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; -public class MlAssignmentNotifier extends AbstractComponent implements ClusterStateListener, LocalNodeMasterListener { +public class MlAssignmentNotifier implements ClusterStateListener, LocalNodeMasterListener { + + private static final Logger logger = LogManager.getLogger(MlAssignmentNotifier.class); private final Auditor auditor; private final ClusterService clusterService; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlInitializationService.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlInitializationService.java index 016fcd5e9287b..1e890b83391d5 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlInitializationService.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlInitializationService.java @@ -9,12 +9,11 @@ import org.elasticsearch.cluster.ClusterChangedEvent; import org.elasticsearch.cluster.ClusterStateListener; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.component.LifecycleListener; import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.threadpool.ThreadPool; -class MlInitializationService extends AbstractComponent implements ClusterStateListener { +class MlInitializationService implements ClusterStateListener { private final ThreadPool threadPool; private final ClusterService clusterService; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlLifeCycleService.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlLifeCycleService.java index 261534556968a..302d9a7611d96 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlLifeCycleService.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MlLifeCycleService.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.ml; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.component.LifecycleListener; import org.elasticsearch.env.Environment; import org.elasticsearch.xpack.ml.datafeed.DatafeedManager; @@ -16,7 +15,7 @@ import java.io.IOException; -public class MlLifeCycleService extends AbstractComponent { +public class MlLifeCycleService { private final Environment environment; private final DatafeedManager datafeedManager; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java index 9f4191b38f2de..56cee0f3d772a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/datafeed/DatafeedManager.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.ml.datafeed; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.Client; @@ -12,7 +14,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateListener; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.util.concurrent.FutureUtils; @@ -51,7 +52,9 @@ import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; import static org.elasticsearch.persistent.PersistentTasksService.WaitForPersistentTaskListener; -public class DatafeedManager extends AbstractComponent { +public class DatafeedManager { + + private static final Logger logger = LogManager.getLogger(DatafeedManager.class); private final Client client; private final ClusterService clusterService; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java index 2e7a19bca1c09..f2421079536b2 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java @@ -6,6 +6,7 @@ package org.elasticsearch.xpack.ml.job; import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.index.IndexResponse; @@ -18,7 +19,6 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.CheckedConsumer; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; @@ -78,12 +78,11 @@ *
  • starting/stopping of datafeed jobs
  • * */ -public class JobManager extends AbstractComponent { +public class JobManager { - private static final DeprecationLogger deprecationLogger = - new DeprecationLogger(LogManager.getLogger(JobManager.class)); + private static final Logger logger = LogManager.getLogger(JobManager.class); + private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); - private final Settings settings; private final Environment environment; private final JobResultsProvider jobResultsProvider; private final ClusterService clusterService; @@ -99,7 +98,6 @@ public class JobManager extends AbstractComponent { public JobManager(Environment environment, Settings settings, JobResultsProvider jobResultsProvider, ClusterService clusterService, Auditor auditor, Client client, UpdateJobProcessNotifier updateJobProcessNotifier) { - this.settings = settings; this.environment = environment; this.jobResultsProvider = Objects.requireNonNull(jobResultsProvider); this.clusterService = Objects.requireNonNull(clusterService); diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java index c0b8b4d93659b..d175df5e9e25a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobDataCountsPersister.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.ml.job.persistence; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.util.Supplier; import org.elasticsearch.action.ActionListener; @@ -12,7 +14,6 @@ import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.client.Client; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex; @@ -29,7 +30,9 @@ * Update a job's dataCounts * i.e. the number of processed records, fields etc. */ -public class JobDataCountsPersister extends AbstractComponent { +public class JobDataCountsPersister { + + private static final Logger logger = LogManager.getLogger(JobDataCountsPersister.class); private final Client client; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobRenormalizedResultsPersister.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobRenormalizedResultsPersister.java index 5ee05feaebf7c..e5f9e8e85959e 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobRenormalizedResultsPersister.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobRenormalizedResultsPersister.java @@ -5,12 +5,13 @@ */ package org.elasticsearch.xpack.ml.job.persistence; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.bulk.BulkRequest; import org.elasticsearch.action.bulk.BulkResponse; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.client.Client; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -37,7 +38,9 @@ *

    * This class is NOT thread safe. */ -public class JobRenormalizedResultsPersister extends AbstractComponent { +public class JobRenormalizedResultsPersister { + + private static final Logger logger = LogManager.getLogger(JobRenormalizedResultsPersister.class); /** * Execute bulk requests when they reach this size diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java index 782f1fc39ef24..e5b411a8117ee 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/persistence/JobResultsPersister.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.ml.job.persistence; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionFuture; import org.elasticsearch.action.ActionListener; @@ -18,7 +20,6 @@ import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.client.Client; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -63,7 +64,9 @@ * * @see ElasticsearchMappings */ -public class JobResultsPersister extends AbstractComponent { +public class JobResultsPersister { + + private static final Logger logger = LogManager.getLogger(JobResultsPersister.class); private final Client client; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java index 1bc214e7b4025..dff118011b147 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java @@ -5,8 +5,9 @@ */ package org.elasticsearch.xpack.ml.job.process; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.xpack.core.ml.job.config.Job; import org.elasticsearch.xpack.core.ml.job.process.autodetect.state.DataCounts; import org.elasticsearch.xpack.ml.job.persistence.JobDataCountsPersister; @@ -33,7 +34,9 @@ * changes when each of the reporting stages are passed. If the * function returns {@code true} the usage is logged. */ -public class DataCountsReporter extends AbstractComponent { +public class DataCountsReporter { + + private static final Logger logger = LogManager.getLogger(DataCountsReporter.class); private final Job job; private final JobDataCountsPersister dataCountsPersister; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java index 887ea5262aeb2..e364203aa6604 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManager.java @@ -5,13 +5,14 @@ */ package org.elasticsearch.xpack.ml.job.process.autodetect; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.Client; import org.elasticsearch.common.CheckedConsumer; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeUnit; @@ -87,7 +88,7 @@ import static org.elasticsearch.xpack.core.ClientHelper.ML_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class AutodetectProcessManager extends AbstractComponent { +public class AutodetectProcessManager { // We should be able from the job config to estimate the memory/cpu a job needs to have, // and if we know that then we can prior to assigning a job to a node fail based on the @@ -108,7 +109,8 @@ public class AutodetectProcessManager extends AbstractComponent { public static final Setting MIN_DISK_SPACE_OFF_HEAP = Setting.byteSizeSetting("xpack.ml.min_disk_space_off_heap", new ByteSizeValue(5, ByteSizeUnit.GB), Property.NodeScope); - private final Settings settings; + private static final Logger logger = LogManager.getLogger(AutodetectProcessManager.class); + private final Client client; private final Environment environment; private final ThreadPool threadPool; @@ -137,7 +139,6 @@ public AutodetectProcessManager(Environment environment, Settings settings, Clie JobDataCountsPersister jobDataCountsPersister, AutodetectProcessFactory autodetectProcessFactory, NormalizerFactory normalizerFactory, NamedXContentRegistry xContentRegistry, Auditor auditor) { - this.settings = settings; this.environment = environment; this.client = client; this.threadPool = threadPool; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParser.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParser.java index 8d7e64c3d45d2..68da1c9fa82ec 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParser.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/autodetect/output/AutodetectResultsParser.java @@ -5,8 +5,9 @@ */ package org.elasticsearch.xpack.ml.job.process.autodetect.output; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchParseException; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentFactory; @@ -25,7 +26,7 @@ * Expects an array of buckets so the first element will always be the * start array symbol and the data must be terminated with the end array symbol. */ -public class AutodetectResultsParser extends AbstractComponent { +public class AutodetectResultsParser { public Iterator parseResults(InputStream in) throws ElasticsearchParseException { try { XContentParser parser = XContentFactory.xContent(XContentType.JSON) @@ -58,7 +59,9 @@ static void consumeAndCloseStream(InputStream in) { } } - private class AutodetectResultIterator implements Iterator { + private static class AutodetectResultIterator implements Iterator { + + private static final Logger logger = LogManager.getLogger(AutodetectResultIterator.class); private final InputStream in; private final XContentParser parser; diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java index 2677e8eb4899f..856042f04debc 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/Collector.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.monitoring.collector; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.util.Supplier; import org.elasticsearch.ElasticsearchTimeoutException; @@ -13,7 +15,6 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.license.XPackLicenseState; @@ -33,7 +34,7 @@ /** * {@link Collector} are used to collect monitoring data about the cluster, nodes and indices. */ -public abstract class Collector extends AbstractComponent { +public abstract class Collector { /** * List of indices names whose stats will be exported (default to all indices) @@ -46,6 +47,7 @@ public abstract class Collector extends AbstractComponent { protected final ClusterService clusterService; protected final XPackLicenseState licenseState; + protected final Logger logger; public Collector(final String name, final ClusterService clusterService, final Setting timeoutSetting, final XPackLicenseState licenseState) { @@ -53,6 +55,7 @@ public Collector(final String name, final ClusterService clusterService, this.clusterService = clusterService; this.collectionTimeoutSetting = timeoutSetting; this.licenseState = licenseState; + this.logger = LogManager.getLogger(getClass()); } public String name() { diff --git a/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeCheck.java b/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeCheck.java index 2b46a661e17b5..62a2829b9258c 100644 --- a/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeCheck.java +++ b/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeCheck.java @@ -10,7 +10,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.protocol.xpack.migration.UpgradeActionRequired; import org.elasticsearch.script.Script; @@ -32,7 +31,7 @@ * - reindex is performed * - postUpgrade is called if reindex was successful */ -public class IndexUpgradeCheck extends AbstractComponent { +public class IndexUpgradeCheck { private final String name; private final Function actionRequired; diff --git a/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeService.java b/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeService.java index 1f51ff391ce2f..fb06c81f25f51 100644 --- a/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeService.java +++ b/x-pack/plugin/upgrade/src/main/java/org/elasticsearch/xpack/upgrade/IndexUpgradeService.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.upgrade; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.IndicesOptions; @@ -12,7 +14,6 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.MetaData; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.protocol.xpack.migration.UpgradeActionRequired; @@ -22,7 +23,9 @@ import java.util.List; import java.util.Map; -public class IndexUpgradeService extends AbstractComponent { +public class IndexUpgradeService { + + private static final Logger logger = LogManager.getLogger(IndexUpgradeService.class); private final List upgradeChecks; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherIndexingListener.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherIndexingListener.java index 156a6e5de2818..bd5907df24310 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherIndexingListener.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherIndexingListener.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.watcher; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.cluster.ClusterChangedEvent; @@ -18,7 +20,6 @@ import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.index.engine.Engine; @@ -55,7 +56,9 @@ * the document should also be added to the local trigger service * */ -final class WatcherIndexingListener extends AbstractComponent implements IndexingOperationListener, ClusterStateListener { +final class WatcherIndexingListener implements IndexingOperationListener, ClusterStateListener { + + private static final Logger logger = LogManager.getLogger(WatcherIndexingListener.class); static final Configuration INACTIVE = new Configuration(null, Collections.emptyMap()); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherLifeCycleService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherLifeCycleService.java index 1bf9c4ded606b..74fa81c89a397 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherLifeCycleService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherLifeCycleService.java @@ -15,7 +15,6 @@ import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.component.LifecycleListener; import org.elasticsearch.gateway.GatewayService; import org.elasticsearch.index.shard.ShardId; @@ -34,7 +33,7 @@ import static org.elasticsearch.cluster.routing.ShardRoutingState.RELOCATING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; -public class WatcherLifeCycleService extends AbstractComponent implements ClusterStateListener { +public class WatcherLifeCycleService implements ClusterStateListener { private final AtomicReference state = new AtomicReference<>(WatcherState.STARTED); private final AtomicReference> previousShardRoutings = new AtomicReference<>(Collections.emptyList()); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java index f26ab5a14fb06..f088633887c32 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/WatcherService.java @@ -6,6 +6,8 @@ package org.elasticsearch.xpack.watcher; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; @@ -22,7 +24,6 @@ import org.elasticsearch.cluster.routing.Preference; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.ShardRouting; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.AbstractRunnable; @@ -66,9 +67,10 @@ import static org.elasticsearch.xpack.core.watcher.support.Exceptions.illegalState; import static org.elasticsearch.xpack.core.watcher.watch.Watch.INDEX; -public class WatcherService extends AbstractComponent { +public class WatcherService { private static final String LIFECYCLE_THREADPOOL_NAME = "watcher-lifecycle"; + private static final Logger logger = LogManager.getLogger(WatcherService.class); private final TriggerService triggerService; private final TriggeredWatchStore triggeredWatchStore; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java index 2a327851558e5..a2714e02c6229 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java @@ -33,8 +33,9 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicNameValuePair; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; @@ -59,13 +60,14 @@ import java.util.List; import java.util.Map; -public class HttpClient extends AbstractComponent implements Closeable { +public class HttpClient implements Closeable { private static final String SETTINGS_SSL_PREFIX = "xpack.http.ssl."; // picking a reasonable high value here to allow for setups with lots of watch executions or many http inputs/actions // this is also used as the value per route, if you are connecting to the same endpoint a lot, which is likely, when // you are querying a remote Elasticsearch cluster private static final int MAX_CONNECTIONS = 500; + private static final Logger logger = LogManager.getLogger(HttpClient.class); private final CloseableHttpClient client; private final HttpProxy settingsProxy; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java index 2beafa9be2804..60f9c02eb297c 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java @@ -6,6 +6,8 @@ package org.elasticsearch.xpack.watcher.execution; import com.google.common.collect.Iterables; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.util.Supplier; import org.elasticsearch.ExceptionsHelper; @@ -22,7 +24,6 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.MapBuilder; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.metrics.MeanMetric; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; @@ -73,12 +74,14 @@ import static org.elasticsearch.xpack.core.ClientHelper.stashWithOrigin; import static org.joda.time.DateTimeZone.UTC; -public class ExecutionService extends AbstractComponent { +public class ExecutionService { public static final Setting DEFAULT_THROTTLE_PERIOD_SETTING = Setting.positiveTimeSetting("xpack.watcher.execution.default_throttle_period", TimeValue.timeValueSeconds(5), Setting.Property.NodeScope); + private static final Logger logger = LogManager.getLogger(ExecutionService.class); + private final MeanMetric totalExecutionsTime = new MeanMetric(); private final Map actionByTypeExecutionTime = new HashMap<>(); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java index 049a7ff200e77..b613cfd6d1891 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/TriggeredWatchStore.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.watcher.execution; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.bulk.BulkItemResponse; @@ -22,7 +24,6 @@ import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.routing.Preference; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; @@ -48,7 +49,9 @@ import static org.elasticsearch.xpack.core.ClientHelper.WATCHER_ORIGIN; -public class TriggeredWatchStore extends AbstractComponent { +public class TriggeredWatchStore { + + private static final Logger logger = LogManager.getLogger(TriggeredWatchStore.class); private final int scrollSize; private final Client client; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java index a20eef6b4895b..d5007061cb631 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/history/HistoryStore.java @@ -5,13 +5,14 @@ */ package org.elasticsearch.xpack.watcher.history; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.logging.log4j.util.Supplier; import org.elasticsearch.action.bulk.BulkProcessor; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField; @@ -25,10 +26,12 @@ import static org.elasticsearch.xpack.core.watcher.support.Exceptions.ioException; -public class HistoryStore extends AbstractComponent { +public class HistoryStore { public static final String DOC_TYPE = "doc"; + private static final Logger logger = LogManager.getLogger(HistoryStore.class); + private final BulkProcessor bulkProcessor; public HistoryStore(BulkProcessor bulkProcessor) { diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java index 0b545c7942821..ae96aa4d0cee5 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/NotificationService.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.watcher.notification; import org.elasticsearch.common.collect.Tuple; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Settings; @@ -21,7 +20,7 @@ /** * Basic notification service */ -public abstract class NotificationService extends AbstractComponent { +public abstract class NotificationService { private final String type; // both are guarded by this diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java index 70922e57bd078..6e28475a7af0e 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/email/EmailService.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.watcher.notification.email; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.SecureSetting; @@ -101,6 +103,8 @@ public class EmailService extends NotificationService { Setting.affixKeySetting("xpack.notification.email.account.", "smtp.wait_on_quit", (key) -> Setting.boolSetting(key, true, Property.Dynamic, Property.NodeScope)); + private static final Logger logger = LogManager.getLogger(EmailService.class); + private final CryptoService cryptoService; public EmailService(Settings settings, @Nullable CryptoService cryptoService, ClusterSettings clusterSettings) { diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java index 58840aec9775b..30eb9f5d62152 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/hipchat/HipChatService.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.watcher.notification.hipchat; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.SecureSetting; import org.elasticsearch.common.settings.SecureString; @@ -60,6 +62,7 @@ public class HipChatService extends NotificationService { Setting.affixKeySetting("xpack.notification.hipchat.account.", "message", (key) -> Setting.groupSetting(key + ".", Setting.Property.Dynamic, Setting.Property.NodeScope)); + private static final Logger logger = LogManager.getLogger(HipChatService.class); private final HttpClient httpClient; private HipChatServer defaultServer; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java index 888da55430a8b..90542f658bc75 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/notification/slack/SlackService.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.watcher.notification.slack; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.SecureSetting; import org.elasticsearch.common.settings.SecureString; @@ -37,6 +39,8 @@ public class SlackService extends NotificationService { Setting.affixKeySetting("xpack.notification.slack.account.", "message_defaults", (key) -> Setting.groupSetting(key + ".", Property.Dynamic, Property.NodeScope)); + private static final Logger logger = LogManager.getLogger(SlackService.class); + private final HttpClient httpClient; public SlackService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) { diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java index 6d0a02062ee17..3258a7a481bb1 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/WatcherIndexTemplateRegistry.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.watcher.support; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; @@ -15,7 +17,6 @@ import org.elasticsearch.cluster.ClusterStateListener; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.gateway.GatewayService; @@ -33,7 +34,7 @@ import static org.elasticsearch.xpack.core.ClientHelper.WATCHER_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin; -public class WatcherIndexTemplateRegistry extends AbstractComponent implements ClusterStateListener { +public class WatcherIndexTemplateRegistry implements ClusterStateListener { public static final TemplateConfig TEMPLATE_CONFIG_TRIGGERED_WATCHES = new TemplateConfig( WatcherIndexTemplateRegistryField.TRIGGERED_TEMPLATE_NAME, "triggered-watches"); @@ -45,6 +46,8 @@ public class WatcherIndexTemplateRegistry extends AbstractComponent implements C TEMPLATE_CONFIG_TRIGGERED_WATCHES, TEMPLATE_CONFIG_WATCH_HISTORY, TEMPLATE_CONFIG_WATCHES }; + private static final Logger logger = LogManager.getLogger(WatcherIndexTemplateRegistry.class); + private final Client client; private final ThreadPool threadPool; private final TemplateConfig[] indexTemplates; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java index d8451fbc7b3b3..4cc3b0cb709aa 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/support/search/WatcherSearchTemplateService.java @@ -7,7 +7,6 @@ import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentFactory; @@ -30,7 +29,7 @@ /** * {@link WatcherSearchTemplateService} renders {@link WatcherSearchTemplateRequest} before their execution. */ -public class WatcherSearchTemplateService extends AbstractComponent { +public class WatcherSearchTemplateService { private final ScriptService scriptService; private final NamedXContentRegistry xContentRegistry; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerService.java index c9d99a2e2c4ff..4c27ec329bbb1 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/TriggerService.java @@ -7,7 +7,6 @@ import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.core.watcher.common.stats.Counters; import org.elasticsearch.xpack.core.watcher.trigger.Trigger; @@ -26,7 +25,7 @@ import static java.util.Collections.unmodifiableMap; import static org.elasticsearch.xpack.core.watcher.support.Exceptions.illegalArgument; -public class TriggerService extends AbstractComponent { +public class TriggerService { private final GroupedConsumer consumer = new GroupedConsumer(); private final Map engines; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEngine.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEngine.java index c53162bd7d9c8..0c6b39c476b84 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEngine.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/ScheduleTriggerEngine.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.watcher.trigger.schedule; import org.elasticsearch.common.Nullable; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.xpack.core.watcher.support.WatcherDateTimeUtils; import org.elasticsearch.xpack.core.watcher.trigger.TriggerEvent; @@ -24,7 +23,7 @@ import static org.elasticsearch.xpack.core.watcher.support.Exceptions.illegalArgument; import static org.joda.time.DateTimeZone.UTC; -public abstract class ScheduleTriggerEngine extends AbstractComponent implements TriggerEngine { +public abstract class ScheduleTriggerEngine implements TriggerEngine { public static final String TYPE = ScheduleTrigger.TYPE; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java index 2fe74be2b0c2e..14a2910c7f6ca 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/engine/TickerScheduleTriggerEngine.java @@ -5,6 +5,8 @@ */ package org.elasticsearch.xpack.watcher.trigger.schedule.engine; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Settings; @@ -36,6 +38,8 @@ public class TickerScheduleTriggerEngine extends ScheduleTriggerEngine { public static final Setting TICKER_INTERVAL_SETTING = positiveTimeSetting("xpack.watcher.trigger.schedule.ticker.tick_interval", TimeValue.timeValueMillis(500), Property.NodeScope); + private static final Logger logger = LogManager.getLogger(TickerScheduleTriggerEngine.class); + private final TimeValue tickInterval; private volatile Map schedules; private Ticker ticker; diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchParser.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchParser.java index 6c0880299376d..ab316c3dd1001 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchParser.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/watch/WatchParser.java @@ -5,10 +5,11 @@ */ package org.elasticsearch.xpack.watcher.watch; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; @@ -48,7 +49,9 @@ import static org.elasticsearch.xpack.core.watcher.support.Exceptions.ioException; import static org.joda.time.DateTimeZone.UTC; -public class WatchParser extends AbstractComponent { +public class WatchParser { + + private static final Logger logger = LogManager.getLogger(WatchParser.class); private final TriggerService triggerService; private final ActionRegistry actionRegistry; diff --git a/x-pack/qa/security-example-spi-extension/src/main/java/org/elasticsearch/example/role/CustomInMemoryRolesProvider.java b/x-pack/qa/security-example-spi-extension/src/main/java/org/elasticsearch/example/role/CustomInMemoryRolesProvider.java index 44616054dc7a8..894ac309bc87f 100644 --- a/x-pack/qa/security-example-spi-extension/src/main/java/org/elasticsearch/example/role/CustomInMemoryRolesProvider.java +++ b/x-pack/qa/security-example-spi-extension/src/main/java/org/elasticsearch/example/role/CustomInMemoryRolesProvider.java @@ -6,7 +6,6 @@ package org.elasticsearch.example.role; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.xpack.core.security.authz.RoleDescriptor; import org.elasticsearch.xpack.core.security.authz.store.RoleRetrievalResult; @@ -19,9 +18,7 @@ * A custom roles provider implementation for testing that serves * static roles from memory. */ -public class CustomInMemoryRolesProvider - extends AbstractComponent - implements BiConsumer, ActionListener> { +public class CustomInMemoryRolesProvider implements BiConsumer, ActionListener> { public static final String INDEX = "foo"; public static final String ROLE_A = "roleA";