|
@@ -49,7 +49,6 @@ import org.elasticsearch.cluster.metadata.MetaData;
|
|
|
import org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService;
|
|
|
import org.elasticsearch.cluster.node.DiscoveryNode;
|
|
|
import org.elasticsearch.cluster.routing.RoutingService;
|
|
|
-import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
|
|
import org.elasticsearch.cluster.service.ClusterService;
|
|
|
import org.elasticsearch.common.StopWatch;
|
|
|
import org.elasticsearch.common.SuppressForbidden;
|
|
@@ -352,7 +351,7 @@ public class Node implements Closeable {
|
|
|
final MonitorService monitorService = new MonitorService(settings, nodeEnvironment, threadPool, clusterInfoService);
|
|
|
modules.add(new NodeModule(this, monitorService));
|
|
|
ClusterModule clusterModule = new ClusterModule(settings, clusterService,
|
|
|
- pluginsService.filterPlugins(ClusterPlugin.class));
|
|
|
+ pluginsService.filterPlugins(ClusterPlugin.class), clusterInfoService);
|
|
|
modules.add(clusterModule);
|
|
|
IndicesModule indicesModule = new IndicesModule(pluginsService.filterPlugins(MapperPlugin.class));
|
|
|
modules.add(indicesModule);
|
|
@@ -437,7 +436,8 @@ public class Node implements Closeable {
|
|
|
|
|
|
final DiscoveryModule discoveryModule = new DiscoveryModule(this.settings, threadPool, transportService, namedWriteableRegistry,
|
|
|
networkService, clusterService.getMasterService(), clusterService.getClusterApplierService(),
|
|
|
- clusterService.getClusterSettings(), pluginsService.filterPlugins(DiscoveryPlugin.class));
|
|
|
+ clusterService.getClusterSettings(), pluginsService.filterPlugins(DiscoveryPlugin.class),
|
|
|
+ clusterModule.getAllocationService());
|
|
|
NodeService nodeService = new NodeService(settings, threadPool, monitorService, discoveryModule.getDiscovery(),
|
|
|
transportService, indicesService, pluginsService, circuitBreakerService, scriptModule.getScriptService(),
|
|
|
httpServerTransport, ingestService, clusterService, settingsModule.getSettingsFilter());
|
|
@@ -488,6 +488,9 @@ public class Node implements Closeable {
|
|
|
);
|
|
|
injector = modules.createInjector();
|
|
|
|
|
|
+ // TODO hack around circular dependencies problems in AllocationService
|
|
|
+ clusterModule.getAllocationService().setGatewayAllocator(injector.getInstance(GatewayAllocator.class));
|
|
|
+
|
|
|
List<LifecycleComponent> pluginLifecycleComponents = pluginComponents.stream()
|
|
|
.filter(p -> p instanceof LifecycleComponent)
|
|
|
.map(p -> (LifecycleComponent) p).collect(Collectors.toList());
|
|
@@ -644,8 +647,6 @@ public class Node implements Closeable {
|
|
|
|
|
|
Logger logger = Loggers.getLogger(Node.class, NODE_NAME_SETTING.get(settings));
|
|
|
logger.info("starting ...");
|
|
|
- // hack around dependency injection problem (for now...)
|
|
|
- injector.getInstance(Discovery.class).setAllocationService(injector.getInstance(AllocationService.class));
|
|
|
pluginLifecycleComponents.forEach(LifecycleComponent::start);
|
|
|
|
|
|
injector.getInstance(MappingUpdatedAction.class).setClient(client);
|
|
@@ -663,9 +664,6 @@ public class Node implements Closeable {
|
|
|
nodeConnectionsService.start();
|
|
|
clusterService.setNodeConnectionsService(nodeConnectionsService);
|
|
|
|
|
|
- // TODO hack around circular dependencies problems
|
|
|
- injector.getInstance(GatewayAllocator.class).setReallocation(clusterService, injector.getInstance(RoutingService.class));
|
|
|
-
|
|
|
injector.getInstance(ResourceWatcherService.class).start();
|
|
|
injector.getInstance(GatewayService.class).start();
|
|
|
Discovery discovery = injector.getInstance(Discovery.class);
|