Remove DiscoveryService and reduce guice to just Discovery elastic/elasticsearch#1571
DiscoveryService was a bridge into the discovery universe. This is unneeded and we can just access discovery directly or do things in a different way. This is a complement to elastic/elasticsearchelastic/elasticsearch#16821 Closes elastic/elasticsearch#1571 Original commit: elastic/x-pack-elasticsearch@496f0c4081
This commit is contained in:
parent
b01521f349
commit
3ddbd77090
|
@ -5,18 +5,16 @@
|
|||
*/
|
||||
package org.elasticsearch.marvel.agent.collector;
|
||||
|
||||
|
||||
import org.elasticsearch.ElasticsearchTimeoutException;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.component.AbstractLifecycleComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.exporter.IndexNameResolver;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -27,18 +25,16 @@ public abstract class AbstractCollector<T> extends AbstractLifecycleComponent<T>
|
|||
private final String name;
|
||||
|
||||
protected final ClusterService clusterService;
|
||||
protected final DiscoveryService discoveryService;
|
||||
protected final MarvelSettings marvelSettings;
|
||||
protected final MarvelLicensee licensee;
|
||||
protected final IndexNameResolver dataIndexNameResolver;
|
||||
|
||||
@Inject
|
||||
public AbstractCollector(Settings settings, String name, ClusterService clusterService, DiscoveryService discoveryService,
|
||||
public AbstractCollector(Settings settings, String name, ClusterService clusterService,
|
||||
MarvelSettings marvelSettings, MarvelLicensee licensee) {
|
||||
super(settings);
|
||||
this.name = name;
|
||||
this.clusterService = clusterService;
|
||||
this.discoveryService = discoveryService;
|
||||
this.marvelSettings = marvelSettings;
|
||||
this.licensee = licensee;
|
||||
this.dataIndexNameResolver = new DataIndexNameResolver(MarvelTemplateUtils.TEMPLATE_VERSION);
|
||||
|
@ -121,7 +117,7 @@ public abstract class AbstractCollector<T> extends AbstractLifecycleComponent<T>
|
|||
}
|
||||
|
||||
protected DiscoveryNode localNode() {
|
||||
return discoveryService.localNode();
|
||||
return clusterService.localNode();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,10 +13,9 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.shield.InternalClient;
|
||||
|
||||
|
@ -40,9 +39,9 @@ public class ClusterStateCollector extends AbstractCollector<ClusterStateCollect
|
|||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public ClusterStateCollector(Settings settings, ClusterService clusterService, DiscoveryService discoveryService,
|
||||
public ClusterStateCollector(Settings settings, ClusterService clusterService,
|
||||
MarvelSettings marvelSettings, MarvelLicensee marvelLicensee, InternalClient client) {
|
||||
super(settings, NAME, clusterService, discoveryService, marvelSettings, marvelLicensee);
|
||||
super(settings, NAME, clusterService, marvelSettings, marvelLicensee);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,11 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.license.plugin.core.LicenseUtils;
|
||||
import org.elasticsearch.license.plugin.core.LicensesManagerService;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.shield.InternalClient;
|
||||
|
||||
|
@ -50,10 +49,10 @@ public class ClusterStatsCollector extends AbstractCollector<ClusterStatsCollect
|
|||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public ClusterStatsCollector(Settings settings, ClusterService clusterService, DiscoveryService discoveryService,
|
||||
public ClusterStatsCollector(Settings settings, ClusterService clusterService,
|
||||
MarvelSettings marvelSettings, MarvelLicensee marvelLicensee, InternalClient client,
|
||||
LicensesManagerService licensesManagerService, ClusterName clusterName) {
|
||||
super(settings, NAME, clusterService, discoveryService, marvelSettings, marvelLicensee);
|
||||
super(settings, NAME, clusterService, marvelSettings, marvelLicensee);
|
||||
this.client = client;
|
||||
this.clusterName = clusterName;
|
||||
this.licensesManagerService = licensesManagerService;
|
||||
|
|
|
@ -12,11 +12,10 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.shield.InternalClient;
|
||||
import org.elasticsearch.shield.Shield;
|
||||
|
@ -41,9 +40,9 @@ public class IndexRecoveryCollector extends AbstractCollector<IndexRecoveryColle
|
|||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public IndexRecoveryCollector(Settings settings, ClusterService clusterService, DiscoveryService discoveryService,
|
||||
public IndexRecoveryCollector(Settings settings, ClusterService clusterService,
|
||||
MarvelSettings marvelSettings, MarvelLicensee marvelLicensee, InternalClient client) {
|
||||
super(settings, NAME, clusterService, discoveryService, marvelSettings, marvelLicensee);
|
||||
super(settings, NAME, clusterService, marvelSettings, marvelLicensee);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,10 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
|||
import org.elasticsearch.cluster.node.DiscoveryNode;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.shield.InternalClient;
|
||||
import org.elasticsearch.shield.Shield;
|
||||
|
@ -43,9 +42,9 @@ public class IndexStatsCollector extends AbstractCollector<IndexStatsCollector>
|
|||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public IndexStatsCollector(Settings settings, ClusterService clusterService, DiscoveryService discoveryService,
|
||||
public IndexStatsCollector(Settings settings, ClusterService clusterService,
|
||||
MarvelSettings marvelSettings, MarvelLicensee marvelLicensee, InternalClient client) {
|
||||
super(settings, NAME, clusterService, discoveryService, marvelSettings, marvelLicensee);
|
||||
super(settings, NAME, clusterService, marvelSettings, marvelLicensee);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,10 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.shield.InternalClient;
|
||||
import org.elasticsearch.shield.Shield;
|
||||
|
@ -38,9 +37,9 @@ public class IndicesStatsCollector extends AbstractCollector<IndicesStatsCollect
|
|||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public IndicesStatsCollector(Settings settings, ClusterService clusterService, DiscoveryService discoveryService,
|
||||
public IndicesStatsCollector(Settings settings, ClusterService clusterService,
|
||||
MarvelSettings marvelSettings, MarvelLicensee marvelLicensee, InternalClient client) {
|
||||
super(settings, NAME, clusterService, discoveryService, marvelSettings, marvelLicensee);
|
||||
super(settings, NAME, clusterService, marvelSettings, marvelLicensee);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,11 +16,10 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
|
|||
import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.shield.InternalClient;
|
||||
|
||||
|
@ -45,9 +44,9 @@ public class NodeStatsCollector extends AbstractCollector<NodeStatsCollector> {
|
|||
|
||||
@Inject
|
||||
public NodeStatsCollector(Settings settings, ClusterService clusterService, MarvelSettings marvelSettings,
|
||||
MarvelLicensee marvelLicensee, InternalClient client, DiscoveryService discoveryService,
|
||||
MarvelLicensee marvelLicensee, InternalClient client,
|
||||
NodeEnvironment nodeEnvironment, DiskThresholdDecider diskThresholdDecider) {
|
||||
super(settings, NAME, clusterService, discoveryService, marvelSettings, marvelLicensee);
|
||||
super(settings, NAME, clusterService, marvelSettings, marvelLicensee);
|
||||
this.client = client;
|
||||
this.nodeEnvironment = nodeEnvironment;
|
||||
this.diskThresholdDecider = diskThresholdDecider;
|
||||
|
|
|
@ -13,10 +13,9 @@ import org.elasticsearch.cluster.routing.ShardRouting;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.regex.Regex;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -37,9 +36,9 @@ public class ShardsCollector extends AbstractCollector<ShardsCollector> {
|
|||
public static final String TYPE = "shards";
|
||||
|
||||
@Inject
|
||||
public ShardsCollector(Settings settings, ClusterService clusterService, DiscoveryService discoveryService,
|
||||
public ShardsCollector(Settings settings, ClusterService clusterService,
|
||||
MarvelSettings marvelSettings, MarvelLicensee marvelLicensee) {
|
||||
super(settings, NAME, clusterService, discoveryService, marvelSettings, marvelLicensee);
|
||||
super(settings, NAME, clusterService, marvelSettings, marvelLicensee);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,11 +9,10 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelTemplateUtils;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -151,7 +150,6 @@ public class ClusterStateCollectorTests extends AbstractCollectorTestCase {
|
|||
assertNotNull(nodeId);
|
||||
return new ClusterStateCollector(internalCluster().getInstance(Settings.class, nodeId),
|
||||
internalCluster().getInstance(ClusterService.class, nodeId),
|
||||
internalCluster().getInstance(DiscoveryService.class, nodeId),
|
||||
internalCluster().getInstance(MarvelSettings.class, nodeId),
|
||||
internalCluster().getInstance(MarvelLicensee.class, nodeId),
|
||||
securedClient(nodeId));
|
||||
|
|
|
@ -9,12 +9,11 @@ import org.apache.lucene.util.LuceneTestCase.BadApple;
|
|||
import org.elasticsearch.cluster.ClusterName;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.license.plugin.core.LicensesManagerService;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollector;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -128,7 +127,6 @@ public class ClusterStatsCollectorTests extends AbstractCollectorTestCase {
|
|||
assertNotNull(nodeId);
|
||||
return new ClusterStatsCollector(internalCluster().getInstance(Settings.class, nodeId),
|
||||
internalCluster().getInstance(ClusterService.class, nodeId),
|
||||
internalCluster().getInstance(DiscoveryService.class, nodeId),
|
||||
internalCluster().getInstance(MarvelSettings.class, nodeId),
|
||||
internalCluster().getInstance(MarvelLicensee.class, nodeId),
|
||||
securedClient(nodeId),
|
||||
|
|
|
@ -10,12 +10,11 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.indices.recovery.RecoveryState;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
||||
|
@ -206,7 +205,6 @@ public class IndexRecoveryCollectorTests extends AbstractCollectorTestCase {
|
|||
}
|
||||
return new IndexRecoveryCollector(internalCluster().getInstance(Settings.class, nodeId),
|
||||
internalCluster().getInstance(ClusterService.class, nodeId),
|
||||
internalCluster().getInstance(DiscoveryService.class, nodeId),
|
||||
internalCluster().getInstance(MarvelSettings.class, nodeId),
|
||||
internalCluster().getInstance(MarvelLicensee.class, nodeId),
|
||||
securedClient(nodeId));
|
||||
|
|
|
@ -9,11 +9,10 @@ import org.elasticsearch.action.admin.indices.stats.IndexStats;
|
|||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
||||
|
@ -239,7 +238,6 @@ public class IndexStatsCollectorTests extends AbstractCollectorTestCase {
|
|||
assertNotNull(nodeId);
|
||||
return new IndexStatsCollector(internalCluster().getInstance(Settings.class, nodeId),
|
||||
internalCluster().getInstance(ClusterService.class, nodeId),
|
||||
internalCluster().getInstance(DiscoveryService.class, nodeId),
|
||||
internalCluster().getInstance(MarvelSettings.class, nodeId),
|
||||
internalCluster().getInstance(MarvelLicensee.class, nodeId),
|
||||
securedClient(nodeId));
|
||||
|
|
|
@ -11,11 +11,10 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
||||
|
@ -209,7 +208,6 @@ public class IndicesStatsCollectorTests extends AbstractCollectorTestCase {
|
|||
}
|
||||
return new IndicesStatsCollector(internalCluster().getInstance(Settings.class, nodeId),
|
||||
internalCluster().getInstance(ClusterService.class, nodeId),
|
||||
internalCluster().getInstance(DiscoveryService.class, nodeId),
|
||||
internalCluster().getInstance(MarvelSettings.class, nodeId),
|
||||
internalCluster().getInstance(MarvelLicensee.class, nodeId),
|
||||
securedClient(nodeId));
|
||||
|
|
|
@ -9,11 +9,10 @@ import org.elasticsearch.bootstrap.BootstrapInfo;
|
|||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.env.NodeEnvironment;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
import org.elasticsearch.shield.InternalClient;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
|
@ -50,7 +49,7 @@ public class NodeStatsCollectorTests extends AbstractCollectorTestCase {
|
|||
assertThat(nodeStatsMarvelDoc.getSourceNode(), notNullValue());
|
||||
|
||||
assertThat(nodeStatsMarvelDoc.getNodeId(),
|
||||
equalTo(internalCluster().getInstance(DiscoveryService.class, node).localNode().id()));
|
||||
equalTo(internalCluster().getInstance(ClusterService.class, node).localNode().id()));
|
||||
assertThat(nodeStatsMarvelDoc.isNodeMaster(), equalTo(node.equals(internalCluster().getMasterName())));
|
||||
assertThat(nodeStatsMarvelDoc.isMlockall(), equalTo(BootstrapInfo.isMemoryLocked()));
|
||||
assertNotNull(nodeStatsMarvelDoc.isDiskThresholdDeciderEnabled());
|
||||
|
@ -96,7 +95,6 @@ public class NodeStatsCollectorTests extends AbstractCollectorTestCase {
|
|||
internalCluster().getInstance(MarvelSettings.class, nodeId),
|
||||
internalCluster().getInstance(MarvelLicensee.class, nodeId),
|
||||
internalCluster().getInstance(InternalClient.class, nodeId),
|
||||
internalCluster().getInstance(DiscoveryService.class, nodeId),
|
||||
internalCluster().getInstance(NodeEnvironment.class, nodeId),
|
||||
internalCluster().getInstance(DiskThresholdDecider.class, nodeId));
|
||||
}
|
||||
|
|
|
@ -9,10 +9,9 @@ import org.elasticsearch.cluster.ClusterService;
|
|||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.routing.ShardRouting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.discovery.DiscoveryService;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.agent.collector.AbstractCollectorTestCase;
|
||||
import org.elasticsearch.marvel.agent.exporter.MarvelDoc;
|
||||
import org.elasticsearch.marvel.MarvelSettings;
|
||||
import org.elasticsearch.marvel.license.MarvelLicensee;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -201,7 +200,6 @@ public class ShardsCollectorTests extends AbstractCollectorTestCase {
|
|||
assertNotNull(nodeId);
|
||||
return new ShardsCollector(internalCluster().getInstance(Settings.class, nodeId),
|
||||
internalCluster().getInstance(ClusterService.class, nodeId),
|
||||
internalCluster().getInstance(DiscoveryService.class, nodeId),
|
||||
internalCluster().getInstance(MarvelSettings.class, nodeId),
|
||||
internalCluster().getInstance(MarvelLicensee.class, nodeId));
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.elasticsearch.cluster.ClusterStateListener;
|
|||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.component.LifecycleListener;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.inject.Provider;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.AbstractRunnable;
|
||||
import org.elasticsearch.shield.audit.AuditTrailModule;
|
||||
|
@ -41,16 +42,19 @@ public class ShieldLifecycleService extends AbstractComponent implements Cluster
|
|||
@Inject
|
||||
public ShieldLifecycleService(Settings settings, ClusterService clusterService, ThreadPool threadPool,
|
||||
IndexAuditTrail indexAuditTrail, ESNativeUsersStore esUserStore,
|
||||
ESNativeRolesStore esRolesStore) {
|
||||
ESNativeRolesStore esRolesStore, Provider<InternalClient> clientProvider) {
|
||||
super(settings);
|
||||
this.settings = settings;
|
||||
this.threadPool = threadPool;
|
||||
this.indexAuditTrail = indexAuditTrail;
|
||||
this.esUserStore = esUserStore;
|
||||
this.esRolesStore = esRolesStore;
|
||||
// TODO: define a common interface for these and delegate from one place. esUserStore store is it's on cluster
|
||||
// state listener , but is also activated from this clusterChanged method
|
||||
clusterService.add(this);
|
||||
clusterService.add(esUserStore);
|
||||
clusterService.add(esRolesStore);
|
||||
clusterService.add(new ShieldTemplateService(settings, clusterService, clientProvider, threadPool));
|
||||
clusterService.addLifecycleListener(new LifecycleListener() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ public class ShieldModule extends AbstractShieldModule {
|
|||
bind(SecurityContext.Secure.class).asEagerSingleton();
|
||||
bind(SecurityContext.class).to(SecurityContext.Secure.class);
|
||||
bind(ShieldLifecycleService.class).asEagerSingleton();
|
||||
bind(ShieldTemplateService.class).asEagerSingleton();
|
||||
bind(InternalClient.Secure.class).asEagerSingleton();
|
||||
bind(InternalClient.class).to(InternalClient.Secure.class);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.elasticsearch.cluster.ClusterStateListener;
|
|||
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
|
||||
import org.elasticsearch.cluster.routing.IndexRoutingTable;
|
||||
import org.elasticsearch.common.component.AbstractComponent;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.inject.Provider;
|
||||
import org.elasticsearch.common.io.Streams;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -41,7 +40,6 @@ public class ShieldTemplateService extends AbstractComponent implements ClusterS
|
|||
private final Provider<InternalClient> clientProvider;
|
||||
private final AtomicBoolean templateCreationPending = new AtomicBoolean(false);
|
||||
|
||||
@Inject
|
||||
public ShieldTemplateService(Settings settings, ClusterService clusterService,
|
||||
Provider<InternalClient> clientProvider, ThreadPool threadPool) {
|
||||
super(settings);
|
||||
|
|
Loading…
Reference in New Issue