Remove unused clusterService instance in ActionModule. (#59826)
This commit is contained in:
parent
9f8ec3e3fb
commit
11b86b3f88
|
@ -241,7 +241,6 @@ import org.elasticsearch.action.update.UpdateAction;
|
|||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.NamedRegistry;
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.common.inject.TypeLiteral;
|
||||
|
@ -423,12 +422,11 @@ public class ActionModule extends AbstractModule {
|
|||
private final RestController restController;
|
||||
private final RequestValidators<PutMappingRequest> mappingRequestValidators;
|
||||
private final RequestValidators<IndicesAliasesRequest> indicesAliasesRequestRequestValidators;
|
||||
private final ClusterService clusterService;
|
||||
|
||||
public ActionModule(boolean transportClient, Settings settings, IndexNameExpressionResolver indexNameExpressionResolver,
|
||||
IndexScopedSettings indexScopedSettings, ClusterSettings clusterSettings, SettingsFilter settingsFilter,
|
||||
ThreadPool threadPool, List<ActionPlugin> actionPlugins, NodeClient nodeClient,
|
||||
CircuitBreakerService circuitBreakerService, UsageService usageService, ClusterService clusterService) {
|
||||
CircuitBreakerService circuitBreakerService, UsageService usageService) {
|
||||
this.transportClient = transportClient;
|
||||
this.settings = settings;
|
||||
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
||||
|
@ -436,7 +434,6 @@ public class ActionModule extends AbstractModule {
|
|||
this.clusterSettings = clusterSettings;
|
||||
this.settingsFilter = settingsFilter;
|
||||
this.actionPlugins = actionPlugins;
|
||||
this.clusterService = clusterService;
|
||||
actions = setupActions(actionPlugins);
|
||||
actionFilters = setupActionFilters(actionPlugins);
|
||||
autoCreateIndex = transportClient ? null : new AutoCreateIndex(settings, clusterSettings, indexNameExpressionResolver);
|
||||
|
|
|
@ -185,7 +185,7 @@ public abstract class TransportClient extends AbstractClient {
|
|||
modules.add(b -> b.bind(ThreadPool.class).toInstance(threadPool));
|
||||
ActionModule actionModule = new ActionModule(true, settings, null, settingsModule.getIndexScopedSettings(),
|
||||
settingsModule.getClusterSettings(), settingsModule.getSettingsFilter(), threadPool,
|
||||
pluginsService.filterPlugins(ActionPlugin.class), null, null, null, null);
|
||||
pluginsService.filterPlugins(ActionPlugin.class), null, null, null);
|
||||
modules.add(actionModule);
|
||||
|
||||
CircuitBreakerService circuitBreakerService = Node.createCircuitBreakerService(settingsModule.getSettings(),
|
||||
|
|
|
@ -527,7 +527,7 @@ public class Node implements Closeable {
|
|||
|
||||
ActionModule actionModule = new ActionModule(false, settings, clusterModule.getIndexNameExpressionResolver(),
|
||||
settingsModule.getIndexScopedSettings(), settingsModule.getClusterSettings(), settingsModule.getSettingsFilter(),
|
||||
threadPool, pluginsService.filterPlugins(ActionPlugin.class), client, circuitBreakerService, usageService, clusterService);
|
||||
threadPool, pluginsService.filterPlugins(ActionPlugin.class), client, circuitBreakerService, usageService);
|
||||
modules.add(actionModule);
|
||||
|
||||
final RestController restController = actionModule.getRestController();
|
||||
|
|
|
@ -109,7 +109,7 @@ public class ActionModuleTests extends ESTestCase {
|
|||
UsageService usageService = new UsageService();
|
||||
ActionModule actionModule = new ActionModule(false, settings.getSettings(), new IndexNameExpressionResolver(),
|
||||
settings.getIndexScopedSettings(), settings.getClusterSettings(), settings.getSettingsFilter(), null, emptyList(), null,
|
||||
null, usageService, null);
|
||||
null, usageService);
|
||||
actionModule.initRestHandlers(null);
|
||||
// At this point the easiest way to confirm that a handler is loaded is to try to register another one on top of it and to fail
|
||||
Exception e = expectThrows(IllegalArgumentException.class, () ->
|
||||
|
@ -148,7 +148,7 @@ public class ActionModuleTests extends ESTestCase {
|
|||
UsageService usageService = new UsageService();
|
||||
ActionModule actionModule = new ActionModule(false, settings.getSettings(), new IndexNameExpressionResolver(),
|
||||
settings.getIndexScopedSettings(), settings.getClusterSettings(), settings.getSettingsFilter(), threadPool,
|
||||
singletonList(dupsMainAction), null, null, usageService, null);
|
||||
singletonList(dupsMainAction), null, null, usageService);
|
||||
Exception e = expectThrows(IllegalArgumentException.class, () -> actionModule.initRestHandlers(null));
|
||||
assertThat(e.getMessage(), startsWith("Cannot replace existing handler for [/] for method: GET"));
|
||||
} finally {
|
||||
|
@ -182,7 +182,7 @@ public class ActionModuleTests extends ESTestCase {
|
|||
UsageService usageService = new UsageService();
|
||||
ActionModule actionModule = new ActionModule(false, settings.getSettings(), new IndexNameExpressionResolver(),
|
||||
settings.getIndexScopedSettings(), settings.getClusterSettings(), settings.getSettingsFilter(), threadPool,
|
||||
singletonList(registersFakeHandler), null, null, usageService, null);
|
||||
singletonList(registersFakeHandler), null, null, usageService);
|
||||
actionModule.initRestHandlers(null);
|
||||
// At this point the easiest way to confirm that a handler is loaded is to try to register another one on top of it and to fail
|
||||
Exception e = expectThrows(IllegalArgumentException.class, () ->
|
||||
|
|
Loading…
Reference in New Issue