Fix plugins service to not double bind plugin components
This commit is contained in:
parent
8263873783
commit
7195d1e0ff
|
@ -141,7 +141,7 @@ public class TransportClient extends AbstractClient {
|
|||
|
||||
ModulesBuilder modules = new ModulesBuilder();
|
||||
// plugin modules must be added here, before others or we can get crazy injection errors...
|
||||
for (Module pluginModule : pluginsService.nodeModules()) {
|
||||
for (Module pluginModule : pluginsService.createGuiceModules()) {
|
||||
modules.add(pluginModule);
|
||||
}
|
||||
modules.add(new NetworkModule(networkService, settings, true, namedWriteableRegistry));
|
||||
|
|
|
@ -134,7 +134,6 @@ import java.util.concurrent.CountDownLatch;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* A node represent a node within a cluster (<tt>cluster.name</tt>). The {@link #client()} can be used
|
||||
|
@ -280,7 +279,7 @@ public class Node implements Closeable {
|
|||
|
||||
ModulesBuilder modules = new ModulesBuilder();
|
||||
// plugin modules must be added here, before others or we can get crazy injection errors...
|
||||
for (Module pluginModule : pluginsService.nodeModules()) {
|
||||
for (Module pluginModule : pluginsService.createGuiceModules()) {
|
||||
modules.add(pluginModule);
|
||||
}
|
||||
final MonitorService monitorService = new MonitorService(settings, nodeEnvironment, threadPool);
|
||||
|
|
|
@ -268,16 +268,10 @@ public class PluginsService extends AbstractComponent {
|
|||
return builder.put(this.settings).build();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Collection<Module> nodeModules() {
|
||||
public Collection<Module> createGuiceModules() {
|
||||
List<Module> modules = new ArrayList<>();
|
||||
for (Tuple<PluginInfo, Plugin> plugin : plugins) {
|
||||
modules.addAll(plugin.v2().createGuiceModules());
|
||||
modules.add(b -> {
|
||||
for (Object c : plugin.v2().createComponents()) {
|
||||
b.bind((Class)c.getClass()).toInstance(c);
|
||||
}
|
||||
});
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
|
|
@ -874,7 +874,7 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
|
|||
}
|
||||
};
|
||||
ModulesBuilder modulesBuilder = new ModulesBuilder();
|
||||
for (Module pluginModule : pluginsService.nodeModules()) {
|
||||
for (Module pluginModule : pluginsService.createGuiceModules()) {
|
||||
modulesBuilder.add(pluginModule);
|
||||
}
|
||||
modulesBuilder.add(
|
||||
|
|
Loading…
Reference in New Issue