From 57a83fce07bac77ccf787c682e5644999fefcc5b Mon Sep 17 00:00:00 2001 From: Jim Hooker Date: Wed, 19 Aug 2015 22:15:45 +0100 Subject: [PATCH] Turn DestructiveOperations.java into a Guice module. https://github.com/elastic/elasticsearch/issues/4665 Inject DestructiveOperations object rather than use new. Use constant rather than hard-coded string --- .../java/org/elasticsearch/action/ActionModule.java | 2 ++ .../indices/close/TransportCloseIndexAction.java | 4 ++-- .../indices/delete/TransportDeleteIndexAction.java | 4 ++-- .../indices/open/TransportOpenIndexAction.java | 5 +++-- .../action/support/DestructiveOperations.java | 13 ++++++------- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/action/ActionModule.java b/core/src/main/java/org/elasticsearch/action/ActionModule.java index a4b71626fa8..4196c695bff 100644 --- a/core/src/main/java/org/elasticsearch/action/ActionModule.java +++ b/core/src/main/java/org/elasticsearch/action/ActionModule.java @@ -156,6 +156,7 @@ import org.elasticsearch.action.suggest.TransportSuggestAction; import org.elasticsearch.action.support.ActionFilter; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.AutoCreateIndex; +import org.elasticsearch.action.support.DestructiveOperations; import org.elasticsearch.action.support.TransportAction; import org.elasticsearch.action.termvectors.*; import org.elasticsearch.action.termvectors.dfs.TransportDfsOnlyAction; @@ -223,6 +224,7 @@ public class ActionModule extends AbstractModule { } bind(ActionFilters.class).asEagerSingleton(); bind(AutoCreateIndex.class).asEagerSingleton(); + bind(DestructiveOperations.class).asEagerSingleton(); registerAction(NodesInfoAction.INSTANCE, TransportNodesInfoAction.class); registerAction(NodesStatsAction.INSTANCE, TransportNodesStatsAction.class); registerAction(NodesHotThreadsAction.INSTANCE, TransportNodesHotThreadsAction.class); diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java b/core/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java index 6eb0c0665c1..e4793027559 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java @@ -48,10 +48,10 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction