From 3c54eb9b8fd25f5724011e3904d07c7598300cd2 Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 14 Jul 2014 19:09:35 +0200 Subject: [PATCH] Internal: make transport action name available in TransportAction base class Each transport action is associated with at least an action name, which is the action name that gets serialized together with the request and identifies what to do with the request itself. Also, the action name is the name of the registered transport handler that handles incoming request for the transport action. This commit makes the action name available in a generic manner in the TransportAction base class, so that it can be used when needed by subclasses, or in the base class for instance for action filtering. Closes #6860 --- .../health/TransportClusterHealthAction.java | 7 +----- .../TransportNodesHotThreadsAction.java | 7 +----- .../node/info/TransportNodesInfoAction.java | 7 +----- .../restart/TransportNodesRestartAction.java | 7 +----- .../TransportNodesShutdownAction.java | 7 +----- .../node/stats/TransportNodesStatsAction.java | 7 +----- .../TransportDeleteRepositoryAction.java | 7 +----- .../get/TransportGetRepositoriesAction.java | 7 +----- .../put/TransportPutRepositoryAction.java | 7 +----- .../TransportClusterRerouteAction.java | 7 +----- .../TransportClusterUpdateSettingsAction.java | 7 +----- .../TransportClusterSearchShardsAction.java | 7 +----- .../create/TransportCreateSnapshotAction.java | 7 +----- .../delete/TransportDeleteSnapshotAction.java | 7 +----- .../get/TransportGetSnapshotsAction.java | 7 +----- .../TransportRestoreSnapshotAction.java | 7 +----- .../status/TransportNodesSnapshotsStatus.java | 9 +++----- .../TransportSnapshotsStatusAction.java | 7 +----- .../state/TransportClusterStateAction.java | 7 +----- .../stats/TransportClusterStatsAction.java | 7 +----- .../TransportPendingClusterTasksAction.java | 7 +----- .../alias/TransportIndicesAliasesAction.java | 7 +----- .../exists/TransportAliasesExistAction.java | 7 +----- .../alias/get/TransportGetAliasesAction.java | 7 +----- .../analyze/TransportAnalyzeAction.java | 7 +----- .../TransportClearIndicesCacheAction.java | 7 +----- .../close/TransportCloseIndexAction.java | 7 +----- .../create/TransportCreateIndexAction.java | 7 +----- .../delete/TransportDeleteIndexAction.java | 7 +----- .../indices/TransportIndicesExistsAction.java | 7 +----- .../types/TransportTypesExistsAction.java | 7 +----- .../indices/flush/TransportFlushAction.java | 7 +----- .../delete/TransportDeleteMappingAction.java | 7 +----- .../get/TransportGetFieldMappingsAction.java | 8 +++---- .../TransportGetFieldMappingsIndexAction.java | 10 +++------ .../get/TransportGetMappingsAction.java | 7 +----- .../put/TransportPutMappingAction.java | 7 +----- .../open/TransportOpenIndexAction.java | 7 +----- .../optimize/TransportOptimizeAction.java | 7 +----- .../recovery/TransportRecoveryAction.java | 7 +----- .../refresh/TransportRefreshAction.java | 7 +----- .../TransportIndicesSegmentsAction.java | 7 +----- .../get/TransportGetSettingsAction.java | 7 +----- .../put/TransportUpdateSettingsAction.java | 7 +----- .../stats/TransportIndicesStatsAction.java | 7 +----- .../TransportDeleteIndexTemplateAction.java | 7 +----- .../get/TransportGetIndexTemplatesAction.java | 7 +----- .../put/TransportPutIndexTemplateAction.java | 7 +----- .../query/TransportValidateQueryAction.java | 7 +----- .../delete/TransportDeleteWarmerAction.java | 7 +----- .../warmer/get/TransportGetWarmersAction.java | 7 +----- .../warmer/put/TransportPutWarmerAction.java | 7 +----- .../bench/TransportAbortBenchmarkAction.java | 7 +----- .../bench/TransportBenchmarkAction.java | 7 +----- .../bench/TransportBenchmarkStatusAction.java | 7 +----- .../action/bulk/TransportBulkAction.java | 2 +- .../action/bulk/TransportShardBulkAction.java | 9 +++----- .../action/count/TransportCountAction.java | 7 +----- .../action/delete/TransportDeleteAction.java | 7 +----- .../index/TransportIndexDeleteAction.java | 9 +++----- .../index/TransportShardDeleteAction.java | 9 +++----- .../TransportDeleteByQueryAction.java | 7 +----- .../TransportIndexDeleteByQueryAction.java | 9 +++----- .../TransportShardDeleteByQueryAction.java | 9 +++----- .../explain/TransportExplainAction.java | 6 +---- .../action/get/TransportGetAction.java | 7 +----- .../action/get/TransportMultiGetAction.java | 2 +- .../get/TransportShardMultiGetAction.java | 9 +++----- .../action/index/TransportIndexAction.java | 7 +----- .../TransportDeleteIndexedScriptAction.java | 7 +++--- .../get/TransportGetIndexedScriptAction.java | 5 +---- .../put/TransportPutIndexedScriptAction.java | 2 +- .../mlt/TransportMoreLikeThisAction.java | 2 +- .../TransportMultiPercolateAction.java | 2 +- .../percolate/TransportPercolateAction.java | 7 +----- .../TransportShardMultiPercolateAction.java | 9 +++----- .../search/TransportClearScrollAction.java | 2 +- .../search/TransportMultiSearchAction.java | 2 +- .../action/search/TransportSearchAction.java | 2 +- .../search/TransportSearchScrollAction.java | 2 +- .../type/TransportSearchTypeAction.java | 2 +- .../suggest/TransportSuggestAction.java | 7 +----- .../support/HandledTransportAction.java | 21 +++--------------- .../action/support/TransportAction.java | 4 +++- .../TransportBroadcastOperationAction.java | 13 ++++------- .../TransportMasterNodeOperationAction.java | 12 ++++------ ...ransportMasterNodeReadOperationAction.java | 4 ++-- .../info/TransportClusterInfoAction.java | 4 ++-- .../nodes/TransportNodesOperationAction.java | 16 +++++--------- ...nsportIndexReplicationOperationAction.java | 14 +++++------- ...portIndicesReplicationOperationAction.java | 17 ++++---------- ...nsportShardReplicationOperationAction.java | 22 ++++++++----------- .../TransportSingleCustomOperationAction.java | 12 ++++------ ...ransportInstanceSingleOperationAction.java | 12 ++++------ .../TransportShardSingleOperationAction.java | 12 ++++------ .../TransportMultiTermVectorsAction.java | 2 +- ...portSingleShardMultiTermsVectorAction.java | 9 +++----- .../TransportSingleShardTermVectorAction.java | 7 +----- .../action/update/TransportUpdateAction.java | 7 +----- .../action/index/MappingUpdatedAction.java | 9 +++----- .../TransportNodesListGatewayMetaState.java | 9 +++----- ...ransportNodesListGatewayStartedShards.java | 11 +++++----- .../TransportNodesListShardStoreMetaData.java | 9 +++----- 103 files changed, 177 insertions(+), 590 deletions(-) diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java index ef52e4257c2..38169227e73 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java @@ -47,7 +47,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadOperati @Inject public TransportClusterHealthAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ClusterName clusterName) { - super(settings, transportService, clusterService, threadPool); + super(settings, ClusterHealthAction.NAME, transportService, clusterService, threadPool); this.clusterName = clusterName; } @@ -57,11 +57,6 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadOperati return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return ClusterHealthAction.NAME; - } - @Override protected ClusterHealthRequest newRequest() { return new ClusterHealthRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/TransportNodesHotThreadsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/TransportNodesHotThreadsAction.java index 184d3d72c48..877df52b27e 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/TransportNodesHotThreadsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/hotthreads/TransportNodesHotThreadsAction.java @@ -45,7 +45,7 @@ public class TransportNodesHotThreadsAction extends TransportNodesOperationActio @Inject public TransportNodesHotThreadsAction(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) { - super(settings, clusterName, threadPool, clusterService, transportService); + super(settings, NodesHotThreadsAction.NAME, clusterName, threadPool, clusterService, transportService); } @Override @@ -53,11 +53,6 @@ public class TransportNodesHotThreadsAction extends TransportNodesOperationActio return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return NodesHotThreadsAction.NAME; - } - @Override protected NodesHotThreadsResponse newResponse(NodesHotThreadsRequest request, AtomicReferenceArray responses) { final List nodes = Lists.newArrayList(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java index 87cf7db8235..1e4bb06de2e 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/info/TransportNodesInfoAction.java @@ -48,7 +48,7 @@ public class TransportNodesInfoAction extends TransportNodesOperationAction nodesInfos = new ArrayList<>(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java index 1572abf2108..f45054fa58f 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/restart/TransportNodesRestartAction.java @@ -58,7 +58,7 @@ public class TransportNodesRestartAction extends TransportNodesOperationAction nodeRestartResponses = newArrayList(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java index 025ef20b685..2a9be0f83ce 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/shutdown/TransportNodesShutdownAction.java @@ -54,7 +54,7 @@ public class TransportNodesShutdownAction extends TransportMasterNodeOperationAc @Inject public TransportNodesShutdownAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, Node node, ClusterName clusterName) { - super(settings, transportService, clusterService, threadPool); + super(settings, NodesShutdownAction.NAME, transportService, clusterService, threadPool); this.node = node; this.clusterName = clusterName; this.disabled = settings.getAsBoolean("action.disable_shutdown", componentSettings.getAsBoolean("disabled", false)); @@ -68,11 +68,6 @@ public class TransportNodesShutdownAction extends TransportMasterNodeOperationAc return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return NodesShutdownAction.NAME; - } - @Override protected NodesShutdownRequest newRequest() { return new NodesShutdownRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java index 52c16a9178b..9b92ce92528 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/TransportNodesStatsAction.java @@ -48,7 +48,7 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction nodeStats = Lists.newArrayList(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java index 33ddeb9a6dc..167cfb1208c 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/TransportDeleteRepositoryAction.java @@ -43,7 +43,7 @@ public class TransportDeleteRepositoryAction extends TransportMasterNodeOperatio @Inject public TransportDeleteRepositoryAction(Settings settings, TransportService transportService, ClusterService clusterService, RepositoriesService repositoriesService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); + super(settings, DeleteRepositoryAction.NAME, transportService, clusterService, threadPool); this.repositoriesService = repositoriesService; } @@ -52,11 +52,6 @@ public class TransportDeleteRepositoryAction extends TransportMasterNodeOperatio return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return DeleteRepositoryAction.NAME; - } - @Override protected DeleteRepositoryRequest newRequest() { return new DeleteRepositoryRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java index c677d934690..45657a39933 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/get/TransportGetRepositoriesAction.java @@ -44,7 +44,7 @@ public class TransportGetRepositoriesAction extends TransportMasterNodeReadOpera @Inject public TransportGetRepositoriesAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); + super(settings, GetRepositoriesAction.NAME, transportService, clusterService, threadPool); } @Override @@ -52,11 +52,6 @@ public class TransportGetRepositoriesAction extends TransportMasterNodeReadOpera return ThreadPool.Names.MANAGEMENT; } - @Override - protected String transportAction() { - return GetRepositoriesAction.NAME; - } - @Override protected GetRepositoriesRequest newRequest() { return new GetRepositoriesRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java index a5aa7673819..036008714d6 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/repositories/put/TransportPutRepositoryAction.java @@ -43,7 +43,7 @@ public class TransportPutRepositoryAction extends TransportMasterNodeOperationAc @Inject public TransportPutRepositoryAction(Settings settings, TransportService transportService, ClusterService clusterService, RepositoriesService repositoriesService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); + super(settings, PutRepositoryAction.NAME, transportService, clusterService, threadPool); this.repositoriesService = repositoriesService; } @@ -52,11 +52,6 @@ public class TransportPutRepositoryAction extends TransportMasterNodeOperationAc return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return PutRepositoryAction.NAME; - } - @Override protected PutRepositoryRequest newRequest() { return new PutRepositoryRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/reroute/TransportClusterRerouteAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/reroute/TransportClusterRerouteAction.java index 143fd92f896..5550753c104 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/reroute/TransportClusterRerouteAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/reroute/TransportClusterRerouteAction.java @@ -43,7 +43,7 @@ public class TransportClusterRerouteAction extends TransportMasterNodeOperationA @Inject public TransportClusterRerouteAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, AllocationService allocationService) { - super(settings, transportService, clusterService, threadPool); + super(settings, ClusterRerouteAction.NAME, transportService, clusterService, threadPool); this.allocationService = allocationService; } @@ -53,11 +53,6 @@ public class TransportClusterRerouteAction extends TransportMasterNodeOperationA return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return ClusterRerouteAction.NAME; - } - @Override protected ClusterRerouteRequest newRequest() { return new ClusterRerouteRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java index fb0842ecab5..70a4392a82a 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/settings/TransportClusterUpdateSettingsAction.java @@ -56,7 +56,7 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeOpe @Inject public TransportClusterUpdateSettingsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, AllocationService allocationService, @ClusterDynamicSettings DynamicSettings dynamicSettings) { - super(settings, transportService, clusterService, threadPool); + super(settings, ClusterUpdateSettingsAction.NAME, transportService, clusterService, threadPool); this.allocationService = allocationService; this.dynamicSettings = dynamicSettings; } @@ -66,11 +66,6 @@ public class TransportClusterUpdateSettingsAction extends TransportMasterNodeOpe return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return ClusterUpdateSettingsAction.NAME; - } - @Override protected ClusterUpdateSettingsRequest newRequest() { return new ClusterUpdateSettingsRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java index 1e1286826ca..2b9849dd882 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/shards/TransportClusterSearchShardsAction.java @@ -44,12 +44,7 @@ public class TransportClusterSearchShardsAction extends TransportMasterNodeReadO @Inject public TransportClusterSearchShardsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); - } - - @Override - protected String transportAction() { - return ClusterSearchShardsAction.NAME; + super(settings, ClusterSearchShardsAction.NAME, transportService, clusterService, threadPool); } @Override diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java index 5b54e414031..c6941bb1238 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java @@ -43,7 +43,7 @@ public class TransportCreateSnapshotAction extends TransportMasterNodeOperationA @Inject public TransportCreateSnapshotAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, SnapshotsService snapshotsService) { - super(settings, transportService, clusterService, threadPool); + super(settings, CreateSnapshotAction.NAME, transportService, clusterService, threadPool); this.snapshotsService = snapshotsService; } @@ -52,11 +52,6 @@ public class TransportCreateSnapshotAction extends TransportMasterNodeOperationA return ThreadPool.Names.SNAPSHOT; } - @Override - protected String transportAction() { - return CreateSnapshotAction.NAME; - } - @Override protected CreateSnapshotRequest newRequest() { return new CreateSnapshotRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java index 07bfb4de584..1acf972e612 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/delete/TransportDeleteSnapshotAction.java @@ -42,7 +42,7 @@ public class TransportDeleteSnapshotAction extends TransportMasterNodeOperationA @Inject public TransportDeleteSnapshotAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, SnapshotsService snapshotsService) { - super(settings, transportService, clusterService, threadPool); + super(settings, DeleteSnapshotAction.NAME, transportService, clusterService, threadPool); this.snapshotsService = snapshotsService; } @@ -51,11 +51,6 @@ public class TransportDeleteSnapshotAction extends TransportMasterNodeOperationA return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return DeleteSnapshotAction.NAME; - } - @Override protected DeleteSnapshotRequest newRequest() { return new DeleteSnapshotRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java index 425d545d3ec..0e2e3a7bd44 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java @@ -45,7 +45,7 @@ public class TransportGetSnapshotsAction extends TransportMasterNodeOperationAct @Inject public TransportGetSnapshotsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, SnapshotsService snapshotsService) { - super(settings, transportService, clusterService, threadPool); + super(settings, GetSnapshotsAction.NAME, transportService, clusterService, threadPool); this.snapshotsService = snapshotsService; } @@ -54,11 +54,6 @@ public class TransportGetSnapshotsAction extends TransportMasterNodeOperationAct return ThreadPool.Names.SNAPSHOT; } - @Override - protected String transportAction() { - return GetSnapshotsAction.NAME; - } - @Override protected GetSnapshotsRequest newRequest() { return new GetSnapshotsRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java index 580832437ef..ab8e96b9a96 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java @@ -44,7 +44,7 @@ public class TransportRestoreSnapshotAction extends TransportMasterNodeOperation @Inject public TransportRestoreSnapshotAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, RestoreService restoreService) { - super(settings, transportService, clusterService, threadPool); + super(settings, RestoreSnapshotAction.NAME, transportService, clusterService, threadPool); this.restoreService = restoreService; } @@ -53,11 +53,6 @@ public class TransportRestoreSnapshotAction extends TransportMasterNodeOperation return ThreadPool.Names.SNAPSHOT; } - @Override - protected String transportAction() { - return RestoreSnapshotAction.NAME; - } - @Override protected RestoreSnapshotRequest newRequest() { return new RestoreSnapshotRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java index 65dedb20319..830de8f379c 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportNodesSnapshotsStatus.java @@ -50,11 +50,13 @@ import java.util.concurrent.atomic.AtomicReferenceArray; */ public class TransportNodesSnapshotsStatus extends TransportNodesOperationAction { + private static final String ACTION_NAME = "cluster/snapshot/status/nodes"; + private final SnapshotsService snapshotsService; @Inject public TransportNodesSnapshotsStatus(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, SnapshotsService snapshotsService) { - super(settings, clusterName, threadPool, clusterService, transportService); + super(settings, ACTION_NAME, clusterName, threadPool, clusterService, transportService); this.snapshotsService = snapshotsService; } @@ -67,11 +69,6 @@ public class TransportNodesSnapshotsStatus extends TransportNodesOperationAction return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return "cluster/snapshot/status/nodes"; - } - @Override protected boolean transportCompress() { return true; // compress since the metadata can become large diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java index 6db23f7194c..c5c8a45978b 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java @@ -55,7 +55,7 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeOperation @Inject public TransportSnapshotsStatusAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, SnapshotsService snapshotsService, TransportNodesSnapshotsStatus transportNodesSnapshotsStatus) { - super(settings, transportService, clusterService, threadPool); + super(settings, SnapshotsStatusAction.NAME, transportService, clusterService, threadPool); this.snapshotsService = snapshotsService; this.transportNodesSnapshotsStatus = transportNodesSnapshotsStatus; } @@ -65,11 +65,6 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeOperation return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return SnapshotsStatusAction.NAME; - } - @Override protected SnapshotsStatusRequest newRequest() { return new SnapshotsStatusRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java index a9f162d23c0..f6d99c59c5b 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java @@ -44,7 +44,7 @@ public class TransportClusterStateAction extends TransportMasterNodeReadOperatio @Inject public TransportClusterStateAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ClusterName clusterName) { - super(settings, transportService, clusterService, threadPool); + super(settings, ClusterStateAction.NAME, transportService, clusterService, threadPool); this.clusterName = clusterName; } @@ -54,11 +54,6 @@ public class TransportClusterStateAction extends TransportMasterNodeReadOperatio return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return ClusterStateAction.NAME; - } - @Override protected ClusterStateRequest newRequest() { return new ClusterStateRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java index bbb5cbad71a..a9ba20c5608 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/stats/TransportClusterStatsAction.java @@ -66,7 +66,7 @@ public class TransportClusterStatsAction extends TransportNodesOperationAction nodeStats = new ArrayList<>(responses.length()); diff --git a/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java b/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java index 9a236814b34..9c4df268ecf 100644 --- a/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java +++ b/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java @@ -37,15 +37,10 @@ public class TransportPendingClusterTasksAction extends TransportMasterNodeReadO @Inject public TransportPendingClusterTasksAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); + super(settings, PendingClusterTasksAction.NAME, transportService, clusterService, threadPool); this.clusterService = clusterService; } - @Override - protected String transportAction() { - return PendingClusterTasksAction.NAME; - } - @Override protected String executor() { // very lightweight operation in memory, no need to fork to a thread diff --git a/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java b/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java index f800685b6ce..ee3120d307b 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java @@ -52,7 +52,7 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeOperationA @Inject public TransportIndicesAliasesAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, MetaDataIndexAliasesService indexAliasesService) { - super(settings, transportService, clusterService, threadPool); + super(settings, IndicesAliasesAction.NAME, transportService, clusterService, threadPool); this.indexAliasesService = indexAliasesService; } @@ -62,11 +62,6 @@ public class TransportIndicesAliasesAction extends TransportMasterNodeOperationA return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return IndicesAliasesAction.NAME; - } - @Override protected IndicesAliasesRequest newRequest() { return new IndicesAliasesRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java b/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java index b9d94348b39..696c14600f9 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java @@ -35,12 +35,7 @@ public class TransportAliasesExistAction extends TransportMasterNodeReadOperatio @Inject public TransportAliasesExistAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); - } - - @Override - protected String transportAction() { - return AliasesExistAction.NAME; + super(settings, AliasesExistAction.NAME, transportService, clusterService, threadPool); } @Override diff --git a/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java b/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java index 553448410ea..183bd0c25cd 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java @@ -38,12 +38,7 @@ public class TransportGetAliasesAction extends TransportMasterNodeReadOperationA @Inject public TransportGetAliasesAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); - } - - @Override - protected String transportAction() { - return GetAliasesAction.NAME; + super(settings, GetAliasesAction.NAME, transportService, clusterService, threadPool); } @Override diff --git a/src/main/java/org/elasticsearch/action/admin/indices/analyze/TransportAnalyzeAction.java b/src/main/java/org/elasticsearch/action/admin/indices/analyze/TransportAnalyzeAction.java index ea2c3235c5f..615d0c371b2 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/analyze/TransportAnalyzeAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/analyze/TransportAnalyzeAction.java @@ -60,7 +60,7 @@ public class TransportAnalyzeAction extends TransportSingleCustomOperationAction @Inject public TransportAnalyzeAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, IndicesService indicesService, IndicesAnalysisService indicesAnalysisService) { - super(settings, threadPool, clusterService, transportService); + super(settings, AnalyzeAction.NAME, threadPool, clusterService, transportService); this.indicesService = indicesService; this.indicesAnalysisService = indicesAnalysisService; } @@ -80,11 +80,6 @@ public class TransportAnalyzeAction extends TransportSingleCustomOperationAction return new AnalyzeResponse(); } - @Override - protected String transportAction() { - return AnalyzeAction.NAME; - } - @Override protected ClusterBlockException checkGlobalBlock(ClusterState state, AnalyzeRequest request) { return state.blocks().globalBlockedException(ClusterBlockLevel.READ); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/TransportClearIndicesCacheAction.java b/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/TransportClearIndicesCacheAction.java index c28ad551fbc..4407821a2b9 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/TransportClearIndicesCacheAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/cache/clear/TransportClearIndicesCacheAction.java @@ -58,7 +58,7 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio public TransportClearIndicesCacheAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, IndicesService indicesService, IndicesTermsFilterCache termsFilterCache, CacheRecycler cacheRecycler) { - super(settings, threadPool, clusterService, transportService); + super(settings, ClearIndicesCacheAction.NAME, threadPool, clusterService, transportService); this.indicesService = indicesService; this.termsFilterCache = termsFilterCache; this.cacheRecycler = cacheRecycler; @@ -69,11 +69,6 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio return ThreadPool.Names.MANAGEMENT; } - @Override - protected String transportAction() { - return ClearIndicesCacheAction.NAME; - } - @Override protected ClearIndicesCacheRequest newRequest() { return new ClearIndicesCacheRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java index cfef1ed47c8..9205d2cd99c 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java @@ -46,7 +46,7 @@ public class TransportCloseIndexAction extends TransportMasterNodeOperationActio @Inject public TransportCloseIndexAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, MetaDataIndexStateService indexStateService, NodeSettingsService nodeSettingsService) { - super(settings, transportService, clusterService, threadPool); + super(settings, CloseIndexAction.NAME, transportService, clusterService, threadPool); this.indexStateService = indexStateService; this.destructiveOperations = new DestructiveOperations(logger, settings, nodeSettingsService); } @@ -57,11 +57,6 @@ public class TransportCloseIndexAction extends TransportMasterNodeOperationActio return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return CloseIndexAction.NAME; - } - @Override protected CloseIndexRequest newRequest() { return new CloseIndexRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java index 5a85495aac2..b42f753cd8f 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java @@ -44,7 +44,7 @@ public class TransportCreateIndexAction extends TransportMasterNodeOperationActi @Inject public TransportCreateIndexAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, MetaDataCreateIndexService createIndexService) { - super(settings, transportService, clusterService, threadPool); + super(settings, CreateIndexAction.NAME, transportService, clusterService, threadPool); this.createIndexService = createIndexService; } @@ -54,11 +54,6 @@ public class TransportCreateIndexAction extends TransportMasterNodeOperationActi return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return CreateIndexAction.NAME; - } - @Override protected CreateIndexRequest newRequest() { return new CreateIndexRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java index 6b7c20f6500..bc173b40df1 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java @@ -47,7 +47,7 @@ public class TransportDeleteIndexAction extends TransportMasterNodeOperationActi public TransportDeleteIndexAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, MetaDataDeleteIndexService deleteIndexService, NodeSettingsService nodeSettingsService) { - super(settings, transportService, clusterService, threadPool); + super(settings, DeleteIndexAction.NAME, transportService, clusterService, threadPool); this.deleteIndexService = deleteIndexService; this.destructiveOperations = new DestructiveOperations(logger, settings, nodeSettingsService); } @@ -57,11 +57,6 @@ public class TransportDeleteIndexAction extends TransportMasterNodeOperationActi return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return DeleteIndexAction.NAME; - } - @Override protected DeleteIndexRequest newRequest() { return new DeleteIndexRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java index e985ca50aea..362e6bf3401 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java @@ -41,7 +41,7 @@ public class TransportIndicesExistsAction extends TransportMasterNodeReadOperati @Inject public TransportIndicesExistsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); + super(settings, IndicesExistsAction.NAME, transportService, clusterService, threadPool); } @Override @@ -50,11 +50,6 @@ public class TransportIndicesExistsAction extends TransportMasterNodeReadOperati return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return IndicesExistsAction.NAME; - } - @Override protected IndicesExistsRequest newRequest() { return new IndicesExistsRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java index 1faa6913e3f..e99c3a0bc2b 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java @@ -40,7 +40,7 @@ public class TransportTypesExistsAction extends TransportMasterNodeReadOperation @Inject public TransportTypesExistsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); + super(settings, TypesExistsAction.NAME, transportService, clusterService, threadPool); } @Override @@ -49,11 +49,6 @@ public class TransportTypesExistsAction extends TransportMasterNodeReadOperation return ThreadPool.Names.SAME; } - @Override - protected String transportAction() { - return TypesExistsAction.NAME; - } - @Override protected TypesExistsRequest newRequest() { return new TypesExistsRequest(); diff --git a/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java b/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java index eb5620b5cd0..1a4e04e3d51 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java @@ -52,7 +52,7 @@ public class TransportFlushAction extends TransportBroadcastOperationAction { + private static final String ACTION_NAME = GetFieldMappingsAction.NAME + "/index"; + protected final ClusterService clusterService; private final IndicesService indicesService; @@ -64,16 +65,11 @@ public class TransportGetFieldMappingsIndexAction extends TransportSingleCustomO TransportService transportService, IndicesService indicesService, ThreadPool threadPool) { - super(settings, threadPool, clusterService, transportService); + super(settings, ACTION_NAME, threadPool, clusterService, transportService); this.clusterService = clusterService; this.indicesService = indicesService; } - @Override - protected String transportAction() { - return GetFieldMappingsAction.NAME + "/index"; - } - @Override protected String executor() { return ThreadPool.Names.MANAGEMENT; diff --git a/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java b/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java index 88a1fa57c20..f2bad904919 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/TransportGetMappingsAction.java @@ -37,12 +37,7 @@ public class TransportGetMappingsAction extends TransportClusterInfoAction { + private static final String ACTION_NAME = "indices/index/delete"; + @Inject public TransportIndexDeleteAction(Settings settings, ClusterService clusterService, TransportService transportService, ThreadPool threadPool, TransportShardDeleteAction deleteAction) { - super(settings, transportService, clusterService, threadPool, deleteAction); + super(settings, ACTION_NAME, transportService, clusterService, threadPool, deleteAction); } @Override @@ -59,11 +61,6 @@ public class TransportIndexDeleteAction extends TransportIndexReplicationOperati return false; } - @Override - protected String transportAction() { - return "indices/index/delete"; - } - @Override protected ClusterBlockException checkGlobalBlock(ClusterState state, IndexDeleteRequest request) { return state.blocks().globalBlockedException(ClusterBlockLevel.WRITE); diff --git a/src/main/java/org/elasticsearch/action/delete/index/TransportShardDeleteAction.java b/src/main/java/org/elasticsearch/action/delete/index/TransportShardDeleteAction.java index 1a300ec375c..8dc861245a8 100644 --- a/src/main/java/org/elasticsearch/action/delete/index/TransportShardDeleteAction.java +++ b/src/main/java/org/elasticsearch/action/delete/index/TransportShardDeleteAction.java @@ -42,11 +42,13 @@ import org.elasticsearch.transport.TransportService; */ public class TransportShardDeleteAction extends TransportShardReplicationOperationAction { + private static final String ACTION_NAME = "indices/index/b_shard/delete"; + @Inject public TransportShardDeleteAction(Settings settings, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction) { - super(settings, transportService, clusterService, indicesService, threadPool, shardStateAction); + super(settings, ACTION_NAME, transportService, clusterService, indicesService, threadPool, shardStateAction); } @Override @@ -69,11 +71,6 @@ public class TransportShardDeleteAction extends TransportShardReplicationOperati return new ShardDeleteResponse(); } - @Override - protected String transportAction() { - return "indices/index/b_shard/delete"; - } - @Override protected String executor() { return ThreadPool.Names.INDEX; diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java b/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java index ee6eacaaef2..6bc2c6b8991 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/TransportDeleteByQueryAction.java @@ -47,7 +47,7 @@ public class TransportDeleteByQueryAction extends TransportIndicesReplicationOpe public TransportDeleteByQueryAction(Settings settings, ClusterService clusterService, TransportService transportService, ThreadPool threadPool, TransportIndexDeleteByQueryAction indexDeleteByQueryAction, NodeSettingsService nodeSettingsService) { - super(settings, transportService, clusterService, threadPool, indexDeleteByQueryAction); + super(settings, DeleteByQueryAction.NAME, transportService, clusterService, threadPool, indexDeleteByQueryAction); this.destructiveOperations = new DestructiveOperations(logger, settings, nodeSettingsService); } @@ -84,11 +84,6 @@ public class TransportDeleteByQueryAction extends TransportIndicesReplicationOpe return false; } - @Override - protected String transportAction() { - return DeleteByQueryAction.NAME; - } - @Override protected ClusterBlockException checkGlobalBlock(ClusterState state, DeleteByQueryRequest replicationPingRequest) { return state.blocks().globalBlockedException(ClusterBlockLevel.READ); diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java b/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java index 8d3806b3200..7a10391757b 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/TransportIndexDeleteByQueryAction.java @@ -38,10 +38,12 @@ import java.util.List; */ public class TransportIndexDeleteByQueryAction extends TransportIndexReplicationOperationAction { + private static final String ACTION_NAME = DeleteByQueryAction.NAME + "/index"; + @Inject public TransportIndexDeleteByQueryAction(Settings settings, ClusterService clusterService, TransportService transportService, ThreadPool threadPool, TransportShardDeleteByQueryAction shardDeleteByQueryAction) { - super(settings, transportService, clusterService, threadPool, shardDeleteByQueryAction); + super(settings, ACTION_NAME, transportService, clusterService, threadPool, shardDeleteByQueryAction); } @Override @@ -59,11 +61,6 @@ public class TransportIndexDeleteByQueryAction extends TransportIndexReplication return true; } - @Override - protected String transportAction() { - return DeleteByQueryAction.NAME + "/index"; - } - @Override protected ClusterBlockException checkGlobalBlock(ClusterState state, IndexDeleteByQueryRequest request) { return state.blocks().globalBlockedException(ClusterBlockLevel.WRITE); diff --git a/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java b/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java index c19aec0455b..2cd38e0e0ab 100644 --- a/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/action/deletebyquery/TransportShardDeleteByQueryAction.java @@ -54,6 +54,8 @@ public class TransportShardDeleteByQueryAction extends TransportShardReplication public final static String DELETE_BY_QUERY_API = "delete_by_query"; + private static final String ACTION_NAME = DeleteByQueryAction.NAME + "/shard"; + private final ScriptService scriptService; private final CacheRecycler cacheRecycler; private final PageCacheRecycler pageCacheRecycler; @@ -64,7 +66,7 @@ public class TransportShardDeleteByQueryAction extends TransportShardReplication ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, ScriptService scriptService, CacheRecycler cacheRecycler, PageCacheRecycler pageCacheRecycler, BigArrays bigArrays) { - super(settings, transportService, clusterService, indicesService, threadPool, shardStateAction); + super(settings, ACTION_NAME, transportService, clusterService, indicesService, threadPool, shardStateAction); this.scriptService = scriptService; this.cacheRecycler = cacheRecycler; this.pageCacheRecycler = pageCacheRecycler; @@ -96,11 +98,6 @@ public class TransportShardDeleteByQueryAction extends TransportShardReplication return new ShardDeleteByQueryResponse(); } - @Override - protected String transportAction() { - return DeleteByQueryAction.NAME + "/shard"; - } - @Override protected ClusterBlockException checkGlobalBlock(ClusterState state, ShardDeleteByQueryRequest request) { return state.blocks().globalBlockedException(ClusterBlockLevel.WRITE); diff --git a/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java b/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java index 309b0cced90..dcc0b48c0d0 100644 --- a/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java +++ b/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java @@ -74,7 +74,7 @@ public class TransportExplainAction extends TransportShardSingleOperationAction< TransportService transportService, IndicesService indicesService, ScriptService scriptService, CacheRecycler cacheRecycler, PageCacheRecycler pageCacheRecycler, BigArrays bigArrays) { - super(settings, threadPool, clusterService, transportService); + super(settings, ExplainAction.NAME, threadPool, clusterService, transportService); this.indicesService = indicesService; this.scriptService = scriptService; this.cacheRecycler = cacheRecycler; @@ -88,10 +88,6 @@ public class TransportExplainAction extends TransportShardSingleOperationAction< super.doExecute(request, listener); } - protected String transportAction() { - return ExplainAction.NAME; - } - protected String executor() { return ThreadPool.Names.GET; // Or use Names.SEARCH? } diff --git a/src/main/java/org/elasticsearch/action/get/TransportGetAction.java b/src/main/java/org/elasticsearch/action/get/TransportGetAction.java index 2a17de01881..a756dc37058 100644 --- a/src/main/java/org/elasticsearch/action/get/TransportGetAction.java +++ b/src/main/java/org/elasticsearch/action/get/TransportGetAction.java @@ -50,7 +50,7 @@ public class TransportGetAction extends TransportShardSingleOperationAction { + private static final String ACTION_NAME = MultiGetAction.NAME + "/shard"; + private final IndicesService indicesService; private final boolean realtime; @@ -49,7 +51,7 @@ public class TransportShardMultiGetAction extends TransportShardSingleOperationA @Inject public TransportShardMultiGetAction(Settings settings, ClusterService clusterService, TransportService transportService, IndicesService indicesService, ThreadPool threadPool) { - super(settings, threadPool, clusterService, transportService); + super(settings, ACTION_NAME, threadPool, clusterService, transportService); this.indicesService = indicesService; this.realtime = settings.getAsBoolean("action.get.realtime", true); @@ -60,11 +62,6 @@ public class TransportShardMultiGetAction extends TransportShardSingleOperationA return ThreadPool.Names.GET; } - @Override - protected String transportAction() { - return MultiGetAction.NAME + "/shard"; - } - @Override protected MultiGetShardRequest newRequest() { return new MultiGetShardRequest(); diff --git a/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java b/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java index e26230f737f..ea6df7aa4a9 100644 --- a/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java +++ b/src/main/java/org/elasticsearch/action/index/TransportIndexAction.java @@ -72,7 +72,7 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi public TransportIndexAction(Settings settings, TransportService transportService, ClusterService clusterService, IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction, TransportCreateIndexAction createIndexAction, MappingUpdatedAction mappingUpdatedAction) { - super(settings, transportService, clusterService, indicesService, threadPool, shardStateAction); + super(settings, IndexAction.NAME, transportService, clusterService, indicesService, threadPool, shardStateAction); this.createIndexAction = createIndexAction; this.mappingUpdatedAction = mappingUpdatedAction; this.autoCreateIndex = new AutoCreateIndex(settings); @@ -146,11 +146,6 @@ public class TransportIndexAction extends TransportShardReplicationOperationActi return new IndexResponse(); } - @Override - protected String transportAction() { - return IndexAction.NAME; - } - @Override protected String executor() { return ThreadPool.Names.INDEX; diff --git a/src/main/java/org/elasticsearch/action/indexedscripts/delete/TransportDeleteIndexedScriptAction.java b/src/main/java/org/elasticsearch/action/indexedscripts/delete/TransportDeleteIndexedScriptAction.java index abd335200ac..e83f7611d3e 100644 --- a/src/main/java/org/elasticsearch/action/indexedscripts/delete/TransportDeleteIndexedScriptAction.java +++ b/src/main/java/org/elasticsearch/action/indexedscripts/delete/TransportDeleteIndexedScriptAction.java @@ -20,16 +20,15 @@ package org.elasticsearch.action.indexedscripts.delete; import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.delete.DeleteAction; -import org.elasticsearch.action.support.DelegatingActionListener; import org.elasticsearch.action.delete.DeleteResponse; +import org.elasticsearch.action.support.DelegatingActionListener; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.script.ScriptService; import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.*; +import org.elasticsearch.transport.TransportService; /** * Performs the delete operation. @@ -42,7 +41,7 @@ public class TransportDeleteIndexedScriptAction extends HandledTransportAction{ - private final String actionName; /** * Call to get an instance of type Request @@ -61,16 +56,6 @@ public abstract class HandledTransportAction extends AbstractComponent { protected final ThreadPool threadPool; + protected final String actionName; - protected TransportAction(Settings settings, ThreadPool threadPool) { + protected TransportAction(Settings settings, String actionName, ThreadPool threadPool) { super(settings); + this.actionName = actionName; this.threadPool = threadPool; } diff --git a/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java b/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java index 43a620d0372..f6ea2742a27 100644 --- a/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/broadcast/TransportBroadcastOperationAction.java @@ -50,21 +50,18 @@ public abstract class TransportBroadcastOperationAction() { + transportService.sendRequest(nodes.masterNode(), actionName, request, new BaseTransportResponseHandler() { @Override public Response newInstance() { return newResponse(); diff --git a/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadOperationAction.java b/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadOperationAction.java index c4d9683f6c4..89439b5bbed 100644 --- a/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadOperationAction.java @@ -35,8 +35,8 @@ public abstract class TransportMasterNodeReadOperationAction extends TransportMasterNodeReadOperationAction { - public TransportClusterInfoAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { - super(settings, transportService, clusterService, threadPool); + public TransportClusterInfoAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { + super(settings, actionName, transportService, clusterService, threadPool); } @Override diff --git a/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java b/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java index 636e782deb5..0911e68c296 100644 --- a/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/nodes/TransportNodesOperationAction.java @@ -29,7 +29,6 @@ import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.*; @@ -48,23 +47,20 @@ public abstract class TransportNodesOperationAction shardAction; - @Inject - public TransportIndexReplicationOperationAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, - TransportShardReplicationOperationAction shardAction) { - super(settings, threadPool); + protected TransportIndexReplicationOperationAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, + ThreadPool threadPool, TransportShardReplicationOperationAction shardAction) { + super(settings, actionName, threadPool); this.clusterService = clusterService; this.shardAction = shardAction; - transportService.registerHandler(transportAction(), new TransportHandler()); + transportService.registerHandler(actionName, new TransportHandler()); } @Override @@ -145,8 +143,6 @@ public abstract class TransportIndexReplicationOperationAction shardResponses, int failuresCount, List shardFailures); - protected abstract String transportAction(); - protected abstract GroupShardsIterator shards(Request request) throws ElasticsearchException; protected abstract ShardRequest newShardRequestInstance(Request request, int shardId); @@ -210,7 +206,7 @@ public abstract class TransportIndexReplicationOperationAction indexAction; - - final String transportAction; - - @Inject - public TransportIndicesReplicationOperationAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, + protected TransportIndicesReplicationOperationAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, TransportIndexReplicationOperationAction indexAction) { - super(settings, threadPool); + super(settings, actionName, threadPool); this.clusterService = clusterService; this.indexAction = indexAction; - this.transportAction = transportAction(); - - transportService.registerHandler(transportAction, new TransportHandler()); + transportService.registerHandler(actionName, new TransportHandler()); } @@ -125,8 +118,6 @@ public abstract class TransportIndicesReplicationOperationAction routing, long startTimeInMillis); protected abstract boolean accumulateExceptions(); @@ -166,7 +157,7 @@ public abstract class TransportIndicesReplicationOperationAction shardOperationOnPrimary(ClusterState clusterState, PrimaryOperationRequest shardRequest); @@ -155,7 +151,7 @@ public abstract class TransportShardReplicationOperationAction() { + transportService.sendRequest(node, actionName, request, transportOptions, new BaseTransportResponseHandler() { @Override public Response newInstance() { @@ -695,9 +691,9 @@ public abstract class TransportShardReplicationOperationAction listener) throws ElasticsearchException; protected abstract Request newRequest(); @@ -212,7 +208,7 @@ public abstract class TransportInstanceSingleOperationAction() { + transportService.sendRequest(node, actionName, request, transportOptions(), new BaseTransportResponseHandler() { @Override public Response newInstance() { diff --git a/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java b/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java index af08373f460..4a6d0a3c5ee 100644 --- a/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java +++ b/src/main/java/org/elasticsearch/action/support/single/shard/TransportShardSingleOperationAction.java @@ -52,20 +52,18 @@ public abstract class TransportShardSingleOperationAction { + private static final String ACTION_NAME = "/gateway/local/meta-state"; + private LocalGatewayMetaState metaState; @Inject public TransportNodesListGatewayMetaState(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) { - super(settings, clusterName, threadPool, clusterService, transportService); + super(settings, ACTION_NAME, clusterName, threadPool, clusterService, transportService); } TransportNodesListGatewayMetaState init(LocalGatewayMetaState metaState) { @@ -67,11 +69,6 @@ public class TransportNodesListGatewayMetaState extends TransportNodesOperationA return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return "/gateway/local/meta-state"; - } - @Override protected boolean transportCompress() { return true; // compress since the metadata can become large diff --git a/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java b/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java index 3163dea526e..5b31ebc1fef 100644 --- a/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java +++ b/src/main/java/org/elasticsearch/gateway/local/state/shards/TransportNodesListGatewayStartedShards.java @@ -47,11 +47,14 @@ import java.util.concurrent.atomic.AtomicReferenceArray; */ public class TransportNodesListGatewayStartedShards extends TransportNodesOperationAction { + private static final String ACTION_NAME = "/gateway/local/started-shards"; + + private LocalGatewayShardsState shardsState; @Inject public TransportNodesListGatewayStartedShards(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) { - super(settings, clusterName, threadPool, clusterService, transportService); + super(settings, ACTION_NAME, clusterName, threadPool, clusterService, transportService); } TransportNodesListGatewayStartedShards initGateway(LocalGatewayShardsState shardsState) { @@ -68,11 +71,6 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesOperat return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return "/gateway/local/started-shards"; - } - @Override protected boolean transportCompress() { return true; // this can become big... @@ -145,6 +143,7 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesOperat super(nodesIds.toArray(new String[nodesIds.size()])); this.shardId = shardId; } + public Request(ShardId shardId, String... nodesIds) { super(nodesIds); this.shardId = shardId; diff --git a/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java b/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java index ff2dbe7e2fa..8b9c538ad7f 100644 --- a/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java +++ b/src/main/java/org/elasticsearch/indices/store/TransportNodesListShardStoreMetaData.java @@ -60,6 +60,8 @@ import java.util.concurrent.atomic.AtomicReferenceArray; */ public class TransportNodesListShardStoreMetaData extends TransportNodesOperationAction { + private static final String ACTION_NAME = "/cluster/nodes/indices/shard/store"; + private final IndicesService indicesService; private final NodeEnvironment nodeEnv; @@ -67,7 +69,7 @@ public class TransportNodesListShardStoreMetaData extends TransportNodesOperatio @Inject public TransportNodesListShardStoreMetaData(Settings settings, ClusterName clusterName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, IndicesService indicesService, NodeEnvironment nodeEnv) { - super(settings, clusterName, threadPool, clusterService, transportService); + super(settings, ACTION_NAME, clusterName, threadPool, clusterService, transportService); this.indicesService = indicesService; this.nodeEnv = nodeEnv; } @@ -81,11 +83,6 @@ public class TransportNodesListShardStoreMetaData extends TransportNodesOperatio return ThreadPool.Names.GENERIC; } - @Override - protected String transportAction() { - return "/cluster/nodes/indices/shard/store"; - } - @Override protected Request newRequest() { return new Request();