Merge pull request #13061 from rjernst/injection_craziness

Add plugin modules before (almost all) others
This commit is contained in:
Ryan Ernst 2015-08-23 11:16:34 -07:00
commit b1d963584e
3 changed files with 14 additions and 10 deletions

View File

@ -316,6 +316,10 @@ public class IndexService extends AbstractIndexComponent implements IndexCompone
final boolean canDeleteShardContent = IndexMetaData.isOnSharedFilesystem(indexSettings) == false || final boolean canDeleteShardContent = IndexMetaData.isOnSharedFilesystem(indexSettings) == false ||
(primary && IndexMetaData.isOnSharedFilesystem(indexSettings)); (primary && IndexMetaData.isOnSharedFilesystem(indexSettings));
ModulesBuilder modules = new ModulesBuilder(); ModulesBuilder modules = new ModulesBuilder();
// plugin modules must be added here, before others or we can get crazy injection errors...
for (Module pluginModule : pluginsService.shardModules(indexSettings)) {
modules.add(pluginModule);
}
modules.add(new IndexShardModule(shardId, primary, indexSettings)); modules.add(new IndexShardModule(shardId, primary, indexSettings));
modules.add(new StoreModule(injector.getInstance(IndexStore.class).shardDirectory(), lock, modules.add(new StoreModule(injector.getInstance(IndexStore.class).shardDirectory(), lock,
new StoreCloseListener(shardId, canDeleteShardContent, new Closeable() { new StoreCloseListener(shardId, canDeleteShardContent, new Closeable() {
@ -326,9 +330,6 @@ public class IndexService extends AbstractIndexComponent implements IndexCompone
}), path)); }), path));
modules.add(new DeletionPolicyModule()); modules.add(new DeletionPolicyModule());
for (Module pluginModule : pluginsService.shardModules(indexSettings)) {
modules.add(pluginModule);
}
pluginsService.processModules(modules); pluginsService.processModules(modules);
try { try {

View File

@ -324,6 +324,10 @@ public class IndicesService extends AbstractLifecycleComponent<IndicesService> i
modules.add(new IndexNameModule(index)); modules.add(new IndexNameModule(index));
modules.add(new LocalNodeIdModule(localNodeId)); modules.add(new LocalNodeIdModule(localNodeId));
modules.add(new IndexSettingsModule(index, indexSettings)); modules.add(new IndexSettingsModule(index, indexSettings));
// plugin modules must be added here, before others or we can get crazy injection errors...
for (Module pluginModule : pluginsService.indexModules(indexSettings)) {
modules.add(pluginModule);
}
modules.add(new IndexStoreModule(indexSettings)); modules.add(new IndexStoreModule(indexSettings));
modules.add(new AnalysisModule(indexSettings, indicesAnalysisService)); modules.add(new AnalysisModule(indexSettings, indicesAnalysisService));
modules.add(new SimilarityModule(indexSettings)); modules.add(new SimilarityModule(indexSettings));
@ -333,9 +337,6 @@ public class IndicesService extends AbstractLifecycleComponent<IndicesService> i
modules.add(new IndexAliasesServiceModule()); modules.add(new IndexAliasesServiceModule());
modules.add(new IndexModule(indexSettings)); modules.add(new IndexModule(indexSettings));
for (Module pluginModule : pluginsService.indexModules(indexSettings)) {
modules.add(pluginModule);
}
pluginsService.processModules(modules); pluginsService.processModules(modules);
Injector indexInjector; Injector indexInjector;

View File

@ -160,6 +160,10 @@ public class Node implements Releasable {
ModulesBuilder modules = new ModulesBuilder(); ModulesBuilder modules = new ModulesBuilder();
modules.add(new Version.Module(version)); modules.add(new Version.Module(version));
modules.add(new CircuitBreakerModule(settings)); modules.add(new CircuitBreakerModule(settings));
// plugin modules must be added here, before others or we can get crazy injection errors...
for (Module pluginModule : pluginsService.nodeModules()) {
modules.add(pluginModule);
}
modules.add(new PluginsModule(pluginsService)); modules.add(new PluginsModule(pluginsService));
modules.add(new SettingsModule(settings)); modules.add(new SettingsModule(settings));
modules.add(new NodeModule(this)); modules.add(new NodeModule(this));
@ -188,9 +192,7 @@ public class Node implements Releasable {
modules.add(new RepositoriesModule()); modules.add(new RepositoriesModule());
modules.add(new TribeModule()); modules.add(new TribeModule());
for (Module pluginModule : pluginsService.nodeModules()) {
modules.add(pluginModule);
}
pluginsService.processModules(modules); pluginsService.processModules(modules);
injector = modules.createInjector(); injector = modules.createInjector();