Child Injectors or Index scoped objects


(AsyncAwait) #1

I am learning the code and sounds like I am getting it.
Would love to fix bugs and contributions back to such a great code base.

What is the intention behind childInjectors? For example,

    ModulesBuilder modules = new ModulesBuilder();
    modules.add(new IndexNameModule(index));
    modules.add(new LocalNodeIdModule(localNodeId));
    modules.add(new IndexSettingsModule(index, indexSettings));
    modules.add(new IndexPluginsModule(indexSettings, pluginsService));
    modules.add(new IndexStoreModule(indexSettings));
    modules.add(new IndexEngineModule(indexSettings));
    modules.add(new AnalysisModule(indexSettings, 

indicesAnalysisService));
modules.add(new SimilarityModule(indexSettings));
modules.add(new IndexCacheModule(indexSettings));
modules.add(new IndexFieldDataModule(indexSettings));
modules.add(new CodecModule(indexSettings));
modules.add(new MapperServiceModule());
modules.add(new IndexQueryParserModule(indexSettings));
modules.add(new IndexAliasesServiceModule());
modules.add(new IndexGatewayModule(indexSettings,
injector.getInstance(Gateway.class)));
modules.add(new IndexModule(indexSettings));

Above modules injects components into a global injector as singletons. I
was guessing - each index (lucene index) would have one instance available
of all this components. But sounds like I am wrong.
What's the point of maintaining such map objects though -

private final Map<String, Injector> indicesInjectors = new HashMap<>();

private volatile ImmutableMap<String, IndexService> indices = 

ImmutableMap.of();

I see the only new instance injected into every index is just Index instance
otherwise all other components are singletons. I am not getting the point
of keeping it in childInjectors.

Any help is greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/8208259b-4dfc-48da-9c4b-fcf2cef6947e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2