Add back guice binding for ZenPing

This should be removed, but some tests still rely on it being availale
from the injector in order to mess with it.
This commit is contained in:
Ryan Ernst 2016-11-08 16:49:48 -08:00
parent 05e96089e1
commit 10d358a985
3 changed files with 8 additions and 2 deletions

View File

@ -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<UnicastHostsProvider, ZenPing> createZenPing,
@ -78,7 +79,7 @@ public class DiscoveryModule {
hostsProvider = Collections::emptyList;
}
final ZenPing zenPing = createZenPing.apply(hostsProvider);
zenPing = createZenPing.apply(hostsProvider);
Map<String, Supplier<Discovery>> 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;
}
}

View File

@ -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);

View File

@ -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);