diff --git a/core/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java b/core/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java index 13bfb62fdfa..df68a9fe648 100644 --- a/core/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java +++ b/core/src/main/java/org/elasticsearch/discovery/DiscoveryModule.java @@ -53,6 +53,7 @@ public class DiscoveryModule { new Setting<>("discovery.zen.hosts_provider", (String)null, Optional::ofNullable, Property.NodeScope); private final Discovery discovery; + private final ZenPing zenPing; public DiscoveryModule(Settings settings, ThreadPool threadPool, TransportService transportService, NetworkService networkService, ClusterService clusterService, Function createZenPing, @@ -78,7 +79,7 @@ public class DiscoveryModule { hostsProvider = Collections::emptyList; } - final ZenPing zenPing = createZenPing.apply(hostsProvider); + zenPing = createZenPing.apply(hostsProvider); Map> discoveryTypes = new HashMap<>(); discoveryTypes.put("zen", @@ -102,4 +103,9 @@ public class DiscoveryModule { public Discovery getDiscovery() { return discovery; } + + // TODO: remove this, it should be completely local to discovery, but service disruption tests want to mess with it + public ZenPing getZenPing() { + return zenPing; + } } diff --git a/core/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java b/core/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java index 90e7d3e2144..8f02b037c20 100644 --- a/core/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java +++ b/core/src/main/java/org/elasticsearch/discovery/zen/ZenDiscovery.java @@ -138,7 +138,6 @@ public class ZenDiscovery extends AbstractLifecycleComponent implements Discover private volatile NodeJoinController nodeJoinController; private volatile NodeRemovalClusterStateTaskExecutor nodeRemovalExecutor; - @Inject public ZenDiscovery(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, ClusterSettings clusterSettings, ZenPing zenPing) { super(settings); diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 4ce71ce1057..d00bb252224 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -445,6 +445,7 @@ public class Node implements Closeable { indicesModule.getMapperRegistry(), settingsModule.getIndexScopedSettings())); b.bind(ClusterInfoService.class).toInstance(clusterInfoService); b.bind(Discovery.class).toInstance(discoveryModule.getDiscovery()); + b.bind(ZenPing.class).toInstance(discoveryModule.getZenPing()); { RecoverySettings recoverySettings = new RecoverySettings(settings, settingsModule.getClusterSettings()); processRecoverySettings(settingsModule.getClusterSettings(), recoverySettings);