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
This commit is contained in:
javanna 2014-07-14 19:09:35 +02:00 committed by Luca Cavanna
parent 4194ab31c8
commit 3c54eb9b8f
103 changed files with 177 additions and 590 deletions

View File

@ -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();

View File

@ -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<NodeHotThreads> nodes = Lists.newArrayList();

View File

@ -48,7 +48,7 @@ public class TransportNodesInfoAction extends TransportNodesOperationAction<Node
public TransportNodesInfoAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
ClusterService clusterService, TransportService transportService,
NodeService nodeService) {
super(settings, clusterName, threadPool, clusterService, transportService);
super(settings, NodesInfoAction.NAME, clusterName, threadPool, clusterService, transportService);
this.nodeService = nodeService;
}
@ -57,11 +57,6 @@ public class TransportNodesInfoAction extends TransportNodesOperationAction<Node
return ThreadPool.Names.MANAGEMENT;
}
@Override
protected String transportAction() {
return NodesInfoAction.NAME;
}
@Override
protected NodesInfoResponse newResponse(NodesInfoRequest nodesInfoRequest, AtomicReferenceArray responses) {
final List<NodeInfo> nodesInfos = new ArrayList<>();

View File

@ -58,7 +58,7 @@ public class TransportNodesRestartAction extends TransportNodesOperationAction<N
public TransportNodesRestartAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
ClusterService clusterService, TransportService transportService,
Node node) {
super(settings, clusterName, threadPool, clusterService, transportService);
super(settings, NodesRestartAction.NAME, clusterName, threadPool, clusterService, transportService);
this.node = node;
disabled = componentSettings.getAsBoolean("disabled", false);
}
@ -73,11 +73,6 @@ public class TransportNodesRestartAction extends TransportNodesOperationAction<N
return ThreadPool.Names.GENERIC;
}
@Override
protected String transportAction() {
return NodesRestartAction.NAME;
}
@Override
protected NodesRestartResponse newResponse(NodesRestartRequest nodesShutdownRequest, AtomicReferenceArray responses) {
final List<NodesRestartResponse.NodeRestartResponse> nodeRestartResponses = newArrayList();

View File

@ -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();

View File

@ -48,7 +48,7 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction<Nod
public TransportNodesStatsAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
ClusterService clusterService, TransportService transportService,
NodeService nodeService) {
super(settings, clusterName, threadPool, clusterService, transportService);
super(settings, NodesStatsAction.NAME, clusterName, threadPool, clusterService, transportService);
this.nodeService = nodeService;
}
@ -57,11 +57,6 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction<Nod
return ThreadPool.Names.MANAGEMENT;
}
@Override
protected String transportAction() {
return NodesStatsAction.NAME;
}
@Override
protected NodesStatsResponse newResponse(NodesStatsRequest nodesInfoRequest, AtomicReferenceArray responses) {
final List<NodeStats> nodeStats = Lists.newArrayList();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -50,11 +50,13 @@ import java.util.concurrent.atomic.AtomicReferenceArray;
*/
public class TransportNodesSnapshotsStatus extends TransportNodesOperationAction<TransportNodesSnapshotsStatus.Request, TransportNodesSnapshotsStatus.NodesSnapshotStatus, TransportNodesSnapshotsStatus.NodeRequest, TransportNodesSnapshotsStatus.NodeSnapshotStatus> {
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

View File

@ -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();

View File

@ -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();

View File

@ -66,7 +66,7 @@ public class TransportClusterStatsAction extends TransportNodesOperationAction<C
public TransportClusterStatsAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
ClusterService clusterService, TransportService transportService,
NodeService nodeService, IndicesService indicesService) {
super(settings, clusterName, threadPool, clusterService, transportService);
super(settings, ClusterStatsAction.NAME, clusterName, threadPool, clusterService, transportService);
this.nodeService = nodeService;
this.indicesService = indicesService;
}
@ -76,11 +76,6 @@ public class TransportClusterStatsAction extends TransportNodesOperationAction<C
return ThreadPool.Names.MANAGEMENT;
}
@Override
protected String transportAction() {
return ClusterStatsAction.NAME;
}
@Override
protected ClusterStatsResponse newResponse(ClusterStatsRequest clusterStatsRequest, AtomicReferenceArray responses) {
final List<ClusterStatsNodeResponse> nodeStats = new ArrayList<>(responses.length());

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -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();

View File

@ -52,7 +52,7 @@ public class TransportFlushAction extends TransportBroadcastOperationAction<Flus
@Inject
public TransportFlushAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, IndicesService indicesService) {
super(settings, threadPool, clusterService, transportService);
super(settings, FlushAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
}
@ -61,11 +61,6 @@ public class TransportFlushAction extends TransportBroadcastOperationAction<Flus
return ThreadPool.Names.FLUSH;
}
@Override
protected String transportAction() {
return FlushAction.NAME;
}
@Override
protected FlushRequest newRequest() {
return new FlushRequest();

View File

@ -73,7 +73,7 @@ public class TransportDeleteMappingAction extends TransportMasterNodeOperationAc
ThreadPool threadPool, MetaDataMappingService metaDataMappingService,
TransportDeleteByQueryAction deleteByQueryAction, TransportRefreshAction refreshAction,
TransportFlushAction flushAction, NodeSettingsService nodeSettingsService) {
super(settings, transportService, clusterService, threadPool);
super(settings, DeleteMappingAction.NAME, transportService, clusterService, threadPool);
this.metaDataMappingService = metaDataMappingService;
this.deleteByQueryAction = deleteByQueryAction;
this.refreshAction = refreshAction;
@ -87,11 +87,6 @@ public class TransportDeleteMappingAction extends TransportMasterNodeOperationAc
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return DeleteMappingAction.NAME;
}
@Override
protected DeleteMappingRequest newRequest() {
return new DeleteMappingRequest();

View File

@ -41,15 +41,13 @@ public class TransportGetFieldMappingsAction extends TransportAction<GetFieldMap
private final ClusterService clusterService;
private final TransportGetFieldMappingsIndexAction shardAction;
private final String transportAction;
@Inject
public TransportGetFieldMappingsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, TransportGetFieldMappingsIndexAction shardAction) {
super(settings, threadPool);
super(settings, GetFieldMappingsAction.NAME, threadPool);
this.clusterService = clusterService;
this.shardAction = shardAction;
this.transportAction = GetFieldMappingsAction.NAME;
transportService.registerHandler(transportAction, new TransportHandler());
transportService.registerHandler(actionName, new TransportHandler());
}
@Override
@ -133,7 +131,7 @@ public class TransportGetFieldMappingsAction extends TransportAction<GetFieldMap
try {
channel.sendResponse(e);
} catch (Exception e1) {
logger.warn("Failed to send error response for action [" + transportAction + "] and request [" + request + "]", e1);
logger.warn("Failed to send error response for action [" + actionName + "] and request [" + request + "]", e1);
}
}
});

View File

@ -21,7 +21,6 @@ package org.elasticsearch.action.admin.indices.mapping.get;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetaData;
@ -56,6 +55,8 @@ import java.util.List;
*/
public class TransportGetFieldMappingsIndexAction extends TransportSingleCustomOperationAction<GetFieldMappingsIndexRequest, GetFieldMappingsResponse> {
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;

View File

@ -37,12 +37,7 @@ public class TransportGetMappingsAction extends TransportClusterInfoAction<GetMa
@Inject
public TransportGetMappingsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, transportService, clusterService, threadPool);
}
@Override
protected String transportAction() {
return GetMappingsAction.NAME;
super(settings, GetMappingsAction.NAME, transportService, clusterService, threadPool);
}
@Override

View File

@ -43,7 +43,7 @@ public class TransportPutMappingAction extends TransportMasterNodeOperationActio
@Inject
public TransportPutMappingAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, MetaDataMappingService metaDataMappingService) {
super(settings, transportService, clusterService, threadPool);
super(settings, PutMappingAction.NAME, transportService, clusterService, threadPool);
this.metaDataMappingService = metaDataMappingService;
}
@ -53,11 +53,6 @@ public class TransportPutMappingAction extends TransportMasterNodeOperationActio
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return PutMappingAction.NAME;
}
@Override
protected PutMappingRequest newRequest() {
return new PutMappingRequest();

View File

@ -46,7 +46,7 @@ public class TransportOpenIndexAction extends TransportMasterNodeOperationAction
@Inject
public TransportOpenIndexAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, MetaDataIndexStateService indexStateService, NodeSettingsService nodeSettingsService) {
super(settings, transportService, clusterService, threadPool);
super(settings, OpenIndexAction.NAME, transportService, clusterService, threadPool);
this.indexStateService = indexStateService;
this.destructiveOperations = new DestructiveOperations(logger, settings, nodeSettingsService);
}
@ -57,11 +57,6 @@ public class TransportOpenIndexAction extends TransportMasterNodeOperationAction
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return OpenIndexAction.NAME;
}
@Override
protected OpenIndexRequest newRequest() {
return new OpenIndexRequest();

View File

@ -53,7 +53,7 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
@Inject
public TransportOptimizeAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
TransportService transportService, IndicesService indicesService) {
super(settings, threadPool, clusterService, transportService);
super(settings, OptimizeAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
}
@ -62,11 +62,6 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
return ThreadPool.Names.OPTIMIZE;
}
@Override
protected String transportAction() {
return OptimizeAction.NAME;
}
@Override
protected OptimizeRequest newRequest() {
return new OptimizeRequest();

View File

@ -66,16 +66,11 @@ public class TransportRecoveryAction extends
public TransportRecoveryAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
TransportService transportService, IndicesService indicesService, RecoveryTarget recoveryTarget) {
super(settings, threadPool, clusterService, transportService);
super(settings, RecoveryAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
this.recoveryTarget = recoveryTarget;
}
@Override
protected String transportAction() {
return RecoveryAction.NAME;
}
@Override
protected String executor() {
return ThreadPool.Names.MANAGEMENT;

View File

@ -53,7 +53,7 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
@Inject
public TransportRefreshAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
TransportService transportService, IndicesService indicesService) {
super(settings, threadPool, clusterService, transportService);
super(settings, RefreshAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
}
@ -62,11 +62,6 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
return ThreadPool.Names.REFRESH;
}
@Override
protected String transportAction() {
return RefreshAction.NAME;
}
@Override
protected RefreshRequest newRequest() {
return new RefreshRequest();

View File

@ -57,7 +57,7 @@ public class TransportIndicesSegmentsAction extends TransportBroadcastOperationA
@Inject
public TransportIndicesSegmentsAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService,
IndicesService indicesService) {
super(settings, threadPool, clusterService, transportService);
super(settings, IndicesSegmentsAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
}
@ -66,11 +66,6 @@ public class TransportIndicesSegmentsAction extends TransportBroadcastOperationA
return ThreadPool.Names.MANAGEMENT;
}
@Override
protected String transportAction() {
return IndicesSegmentsAction.NAME;
}
@Override
protected IndicesSegmentsRequest newRequest() {
return new IndicesSegmentsRequest();

View File

@ -46,15 +46,10 @@ public class TransportGetSettingsAction extends TransportMasterNodeReadOperation
@Inject
public TransportGetSettingsAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, SettingsFilter settingsFilter) {
super(settings, transportService, clusterService, threadPool);
super(settings, GetSettingsAction.NAME, transportService, clusterService, threadPool);
this.settingsFilter = settingsFilter;
}
@Override
protected String transportAction() {
return GetSettingsAction.NAME;
}
@Override
protected String executor() {
// Very lightweight operation

View File

@ -41,7 +41,7 @@ public class TransportUpdateSettingsAction extends TransportMasterNodeOperationA
@Inject
public TransportUpdateSettingsAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
MetaDataUpdateSettingsService updateSettingsService) {
super(settings, transportService, clusterService, threadPool);
super(settings, UpdateSettingsAction.NAME, transportService, clusterService, threadPool);
this.updateSettingsService = updateSettingsService;
}
@ -51,11 +51,6 @@ public class TransportUpdateSettingsAction extends TransportMasterNodeOperationA
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return UpdateSettingsAction.NAME;
}
@Override
protected UpdateSettingsRequest newRequest() {
return new UpdateSettingsRequest();

View File

@ -57,7 +57,7 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
@Inject
public TransportIndicesStatsAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService,
IndicesService indicesService) {
super(settings, threadPool, clusterService, transportService);
super(settings, IndicesStatsAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
}
@ -66,11 +66,6 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
return ThreadPool.Names.MANAGEMENT;
}
@Override
protected String transportAction() {
return IndicesStatsAction.NAME;
}
@Override
protected IndicesStatsRequest newRequest() {
return new IndicesStatsRequest();

View File

@ -41,7 +41,7 @@ public class TransportDeleteIndexTemplateAction extends TransportMasterNodeOpera
@Inject
public TransportDeleteIndexTemplateAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, MetaDataIndexTemplateService indexTemplateService) {
super(settings, transportService, clusterService, threadPool);
super(settings, DeleteIndexTemplateAction.NAME, transportService, clusterService, threadPool);
this.indexTemplateService = indexTemplateService;
}
@ -51,11 +51,6 @@ public class TransportDeleteIndexTemplateAction extends TransportMasterNodeOpera
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return DeleteIndexTemplateAction.NAME;
}
@Override
protected DeleteIndexTemplateRequest newRequest() {
return new DeleteIndexTemplateRequest();

View File

@ -41,12 +41,7 @@ public class TransportGetIndexTemplatesAction extends TransportMasterNodeReadOpe
@Inject
public TransportGetIndexTemplatesAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, transportService, clusterService, threadPool);
}
@Override
protected String transportAction() {
return GetIndexTemplatesAction.NAME;
super(settings, GetIndexTemplatesAction.NAME, transportService, clusterService, threadPool);
}
@Override

View File

@ -41,7 +41,7 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeOperatio
@Inject
public TransportPutIndexTemplateAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, MetaDataIndexTemplateService indexTemplateService) {
super(settings, transportService, clusterService, threadPool);
super(settings, PutIndexTemplateAction.NAME, transportService, clusterService, threadPool);
this.indexTemplateService = indexTemplateService;
}
@ -51,11 +51,6 @@ public class TransportPutIndexTemplateAction extends TransportMasterNodeOperatio
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return PutIndexTemplateAction.NAME;
}
@Override
protected PutIndexTemplateRequest newRequest() {
return new PutIndexTemplateRequest();

View File

@ -73,7 +73,7 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
@Inject
public TransportValidateQueryAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, IndicesService indicesService, ScriptService scriptService, CacheRecycler cacheRecycler, PageCacheRecycler pageCacheRecycler, BigArrays bigArrays) {
super(settings, threadPool, clusterService, transportService);
super(settings, ValidateQueryAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
this.scriptService = scriptService;
this.cacheRecycler = cacheRecycler;
@ -92,11 +92,6 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
return ThreadPool.Names.SEARCH;
}
@Override
protected String transportAction() {
return ValidateQueryAction.NAME;
}
@Override
protected ValidateQueryRequest newRequest() {
return new ValidateQueryRequest();

View File

@ -49,7 +49,7 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct
@Inject
public TransportDeleteWarmerAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, transportService, clusterService, threadPool);
super(settings, DeleteWarmerAction.NAME, transportService, clusterService, threadPool);
}
@Override
@ -58,11 +58,6 @@ public class TransportDeleteWarmerAction extends TransportMasterNodeOperationAct
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return DeleteWarmerAction.NAME;
}
@Override
protected DeleteWarmerRequest newRequest() {
return new DeleteWarmerRequest();

View File

@ -38,12 +38,7 @@ public class TransportGetWarmersAction extends TransportClusterInfoAction<GetWar
@Inject
public TransportGetWarmersAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, transportService, clusterService, threadPool);
}
@Override
protected String transportAction() {
return GetWarmersAction.NAME;
super(settings, GetWarmersAction.NAME, transportService, clusterService, threadPool);
}
@Override

View File

@ -54,7 +54,7 @@ public class TransportPutWarmerAction extends TransportMasterNodeOperationAction
@Inject
public TransportPutWarmerAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
TransportSearchAction searchAction) {
super(settings, transportService, clusterService, threadPool);
super(settings, PutWarmerAction.NAME, transportService, clusterService, threadPool);
this.searchAction = searchAction;
}
@ -63,11 +63,6 @@ public class TransportPutWarmerAction extends TransportMasterNodeOperationAction
return ThreadPool.Names.SAME;
}
@Override
protected String transportAction() {
return PutWarmerAction.NAME;
}
@Override
protected PutWarmerRequest newRequest() {
return new PutWarmerRequest();

View File

@ -38,15 +38,10 @@ public class TransportAbortBenchmarkAction extends TransportMasterNodeOperationA
@Inject
public TransportAbortBenchmarkAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, BenchmarkService service) {
super(settings, transportService, clusterService, threadPool);
super(settings, AbortBenchmarkAction.NAME, transportService, clusterService, threadPool);
this.service = service;
}
@Override
protected String transportAction() {
return AbortBenchmarkAction.NAME;
}
@Override
protected String executor() {
return ThreadPool.Names.GENERIC;

View File

@ -39,15 +39,10 @@ public class TransportBenchmarkAction extends TransportMasterNodeOperationAction
@Inject
public TransportBenchmarkAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, BenchmarkService service) {
super(settings, transportService, clusterService, threadPool);
super(settings, BenchmarkAction.NAME, transportService, clusterService, threadPool);
this.service = service;
}
@Override
protected String transportAction() {
return BenchmarkAction.NAME;
}
@Override
protected String executor() {
return ThreadPool.Names.GENERIC;

View File

@ -39,15 +39,10 @@ public class TransportBenchmarkStatusAction extends TransportMasterNodeOperation
@Inject
public TransportBenchmarkStatusAction(Settings settings, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, BenchmarkService service) {
super(settings, transportService, clusterService, threadPool);
super(settings, BenchmarkStatusAction.NAME, transportService, clusterService, threadPool);
this.service = service;
}
@Override
protected String transportAction() {
return BenchmarkStatusAction.NAME;
}
@Override
protected String executor() {
return ThreadPool.Names.GENERIC;

View File

@ -77,7 +77,7 @@ public class TransportBulkAction extends TransportAction<BulkRequest, BulkRespon
@Inject
public TransportBulkAction(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterService clusterService,
TransportShardBulkAction shardBulkAction, TransportCreateIndexAction createIndexAction) {
super(settings, threadPool);
super(settings, BulkAction.NAME, threadPool);
this.clusterService = clusterService;
this.shardBulkAction = shardBulkAction;
this.createIndexAction = createIndexAction;

View File

@ -75,6 +75,8 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
private final static String OP_TYPE_UPDATE = "update";
private final static String OP_TYPE_DELETE = "delete";
private static final String ACTION_NAME = BulkAction.NAME + "/shard";
private final MappingUpdatedAction mappingUpdatedAction;
private final UpdateHelper updateHelper;
private final boolean allowIdGeneration;
@ -83,7 +85,7 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
public TransportShardBulkAction(Settings settings, TransportService transportService, ClusterService clusterService,
IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction,
MappingUpdatedAction mappingUpdatedAction, UpdateHelper updateHelper) {
super(settings, transportService, clusterService, indicesService, threadPool, shardStateAction);
super(settings, ACTION_NAME, transportService, clusterService, indicesService, threadPool, shardStateAction);
this.mappingUpdatedAction = mappingUpdatedAction;
this.updateHelper = updateHelper;
this.allowIdGeneration = settings.getAsBoolean("action.allow_id_generation", true);
@ -119,11 +121,6 @@ public class TransportShardBulkAction extends TransportShardReplicationOperation
return new BulkShardResponse();
}
@Override
protected String transportAction() {
return BulkAction.NAME + "/shard";
}
@Override
protected ClusterBlockException checkGlobalBlock(ClusterState state, BulkShardRequest request) {
return state.blocks().globalBlockedException(ClusterBlockLevel.WRITE);

View File

@ -77,7 +77,7 @@ public class TransportCountAction extends TransportBroadcastOperationAction<Coun
public TransportCountAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService,
IndicesService indicesService, ScriptService scriptService, CacheRecycler cacheRecycler,
PageCacheRecycler pageCacheRecycler, BigArrays bigArrays) {
super(settings, threadPool, clusterService, transportService);
super(settings, CountAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
this.scriptService = scriptService;
this.cacheRecycler = cacheRecycler;
@ -96,11 +96,6 @@ public class TransportCountAction extends TransportBroadcastOperationAction<Coun
return ThreadPool.Names.SEARCH;
}
@Override
protected String transportAction() {
return CountAction.NAME;
}
@Override
protected CountRequest newRequest() {
return new CountRequest();

View File

@ -64,7 +64,7 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct
public TransportDeleteAction(Settings settings, TransportService transportService, ClusterService clusterService,
IndicesService indicesService, ThreadPool threadPool, ShardStateAction shardStateAction,
TransportCreateIndexAction createIndexAction, TransportIndexDeleteAction indexDeleteAction) {
super(settings, transportService, clusterService, indicesService, threadPool, shardStateAction);
super(settings, DeleteAction.NAME, transportService, clusterService, indicesService, threadPool, shardStateAction);
this.createIndexAction = createIndexAction;
this.indexDeleteAction = indexDeleteAction;
this.autoCreateIndex = new AutoCreateIndex(settings);
@ -166,11 +166,6 @@ public class TransportDeleteAction extends TransportShardReplicationOperationAct
return new DeleteResponse();
}
@Override
protected String transportAction() {
return DeleteAction.NAME;
}
@Override
protected ClusterBlockException checkGlobalBlock(ClusterState state, DeleteRequest request) {
return state.blocks().globalBlockedException(ClusterBlockLevel.WRITE);

View File

@ -38,10 +38,12 @@ import java.util.List;
*/
public class TransportIndexDeleteAction extends TransportIndexReplicationOperationAction<IndexDeleteRequest, IndexDeleteResponse, ShardDeleteRequest, ShardDeleteRequest, ShardDeleteResponse> {
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);

View File

@ -42,11 +42,13 @@ import org.elasticsearch.transport.TransportService;
*/
public class TransportShardDeleteAction extends TransportShardReplicationOperationAction<ShardDeleteRequest, ShardDeleteRequest, ShardDeleteResponse> {
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;

View File

@ -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);

View File

@ -38,10 +38,12 @@ import java.util.List;
*/
public class TransportIndexDeleteByQueryAction extends TransportIndexReplicationOperationAction<IndexDeleteByQueryRequest, IndexDeleteByQueryResponse, ShardDeleteByQueryRequest, ShardDeleteByQueryRequest, ShardDeleteByQueryResponse> {
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);

View File

@ -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);

View File

@ -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?
}

View File

@ -50,7 +50,7 @@ public class TransportGetAction extends TransportShardSingleOperationAction<GetR
@Inject
public TransportGetAction(Settings settings, ClusterService clusterService, TransportService transportService,
IndicesService indicesService, ThreadPool threadPool) {
super(settings, threadPool, clusterService, transportService);
super(settings, GetAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
this.realtime = settings.getAsBoolean("action.get.realtime", true);
@ -61,11 +61,6 @@ public class TransportGetAction extends TransportShardSingleOperationAction<GetR
return ThreadPool.Names.GET;
}
@Override
protected String transportAction() {
return GetAction.NAME;
}
@Override
protected ClusterBlockException checkGlobalBlock(ClusterState state, GetRequest request) {
return state.blocks().globalBlockedException(ClusterBlockLevel.READ);

View File

@ -46,7 +46,7 @@ public class TransportMultiGetAction extends TransportAction<MultiGetRequest, Mu
@Inject
public TransportMultiGetAction(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, TransportShardMultiGetAction shardAction) {
super(settings, threadPool);
super(settings, MultiGetAction.NAME, threadPool);
this.clusterService = clusterService;
this.shardAction = shardAction;

View File

@ -42,6 +42,8 @@ import org.elasticsearch.transport.TransportService;
public class TransportShardMultiGetAction extends TransportShardSingleOperationAction<MultiGetShardRequest, MultiGetShardResponse> {
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();

View File

@ -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;

View File

@ -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<D
@Inject
public TransportDeleteIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService,
Client client, TransportService transportService) {
super(settings, threadPool, transportService, DeleteIndexedScriptAction.NAME);
super(settings, DeleteIndexedScriptAction.NAME, threadPool, transportService);
this.scriptService = scriptService;
this.client = client;
}

View File

@ -22,14 +22,11 @@ package org.elasticsearch.action.indexedscripts.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.support.HandledTransportAction;
import org.elasticsearch.action.support.TransportAction;
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.BaseTransportRequestHandler;
import org.elasticsearch.transport.TransportChannel;
import org.elasticsearch.transport.TransportService;
/**
@ -44,7 +41,7 @@ public class TransportGetIndexedScriptAction extends HandledTransportAction<GetI
@Inject
public TransportGetIndexedScriptAction(Settings settings, ThreadPool threadPool, ScriptService scriptService,
TransportService transportService, Client client) {
super(settings, threadPool,transportService, GetIndexedScriptAction.NAME);
super(settings, GetIndexedScriptAction.NAME, threadPool,transportService);
this.scriptService = scriptService;
this.client = client;
}

View File

@ -42,7 +42,7 @@ public class TransportPutIndexedScriptAction extends HandledTransportAction<PutI
public TransportPutIndexedScriptAction(Settings settings, ThreadPool threadPool,
ScriptService scriptService, Client client,
TransportService transportService) {
super(settings,threadPool, transportService, PutIndexedScriptAction.NAME);
super(settings, PutIndexedScriptAction.NAME, threadPool, transportService);
this.client = client;
this.scriptService = scriptService;
}

View File

@ -79,7 +79,7 @@ public class TransportMoreLikeThisAction extends TransportAction<MoreLikeThisReq
@Inject
public TransportMoreLikeThisAction(Settings settings, ThreadPool threadPool, TransportSearchAction searchAction, TransportGetAction getAction,
ClusterService clusterService, IndicesService indicesService, TransportService transportService) {
super(settings, threadPool);
super(settings, MoreLikeThisAction.NAME, threadPool);
this.searchAction = searchAction;
this.getAction = getAction;
this.indicesService = indicesService;

View File

@ -61,7 +61,7 @@ public class TransportMultiPercolateAction extends TransportAction<MultiPercolat
public TransportMultiPercolateAction(Settings settings, ThreadPool threadPool, TransportShardMultiPercolateAction shardMultiPercolateAction,
ClusterService clusterService, TransportService transportService, PercolatorService percolatorService,
TransportMultiGetAction multiGetAction) {
super(settings, threadPool);
super(settings, MultiPercolateAction.NAME, threadPool);
this.shardMultiPercolateAction = shardMultiPercolateAction;
this.clusterService = clusterService;
this.percolatorService = percolatorService;

View File

@ -61,7 +61,7 @@ public class TransportPercolateAction extends TransportBroadcastOperationAction<
public TransportPercolateAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
TransportService transportService, PercolatorService percolatorService,
TransportGetAction getAction) {
super(settings, threadPool, clusterService, transportService);
super(settings, PercolateAction.NAME, threadPool, clusterService, transportService);
this.percolatorService = percolatorService;
this.getAction = getAction;
}
@ -102,11 +102,6 @@ public class TransportPercolateAction extends TransportBroadcastOperationAction<
return new PercolateRequest();
}
@Override
protected String transportAction() {
return PercolateAction.NAME;
}
@Override
protected ClusterBlockException checkGlobalBlock(ClusterState state, PercolateRequest request) {
return state.blocks().globalBlockedException(ClusterBlockLevel.READ);

View File

@ -50,17 +50,14 @@ public class TransportShardMultiPercolateAction extends TransportShardSingleOper
private final PercolatorService percolatorService;
private static final String ACTION_NAME = "mpercolate/shard";
@Inject
public TransportShardMultiPercolateAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, PercolatorService percolatorService) {
super(settings, threadPool, clusterService, transportService);
super(settings, ACTION_NAME, threadPool, clusterService, transportService);
this.percolatorService = percolatorService;
}
@Override
protected String transportAction() {
return "mpercolate/shard";
}
@Override
protected String executor() {
return ThreadPool.Names.PERCOLATE;

View File

@ -51,7 +51,7 @@ public class TransportClearScrollAction extends TransportAction<ClearScrollReque
@Inject
public TransportClearScrollAction(Settings settings, TransportService transportService, ThreadPool threadPool, ClusterService clusterService, SearchServiceTransportAction searchServiceTransportAction) {
super(settings, threadPool);
super(settings, ClearScrollAction.NAME, threadPool);
this.clusterService = clusterService;
this.searchServiceTransportAction = searchServiceTransportAction;
transportService.registerHandler(ClearScrollAction.NAME, new TransportHandler());

View File

@ -45,7 +45,7 @@ public class TransportMultiSearchAction extends TransportAction<MultiSearchReque
@Inject
public TransportMultiSearchAction(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, TransportSearchAction searchAction) {
super(settings, threadPool);
super(settings, MultiSearchAction.NAME, threadPool);
this.clusterService = clusterService;
this.searchAction = searchAction;

View File

@ -60,7 +60,7 @@ public class TransportSearchAction extends TransportAction<SearchRequest, Search
TransportSearchQueryAndFetchAction queryAndFetchAction,
TransportSearchScanAction scanAction,
TransportSearchCountAction countAction) {
super(settings, threadPool);
super(settings, SearchAction.NAME, threadPool);
this.clusterService = clusterService;
this.dfsQueryThenFetchAction = dfsQueryThenFetchAction;
this.queryThenFetchAction = queryThenFetchAction;

View File

@ -52,7 +52,7 @@ public class TransportSearchScrollAction extends TransportAction<SearchScrollReq
TransportSearchScrollQueryThenFetchAction queryThenFetchAction,
TransportSearchScrollQueryAndFetchAction queryAndFetchAction,
TransportSearchScrollScanAction scanAction) {
super(settings, threadPool);
super(settings, SearchScrollAction.NAME, threadPool);
this.queryThenFetchAction = queryThenFetchAction;
this.queryAndFetchAction = queryAndFetchAction;
this.scanAction = scanAction;

View File

@ -70,7 +70,7 @@ public abstract class TransportSearchTypeAction extends TransportAction<SearchRe
public TransportSearchTypeAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
SearchServiceTransportAction searchService, SearchPhaseController searchPhaseController) {
super(settings, threadPool);
super(settings, SearchAction.NAME, threadPool);
this.clusterService = clusterService;
this.searchService = searchService;
this.searchPhaseController = searchPhaseController;

View File

@ -67,7 +67,7 @@ public class TransportSuggestAction extends TransportBroadcastOperationAction<Su
@Inject
public TransportSuggestAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService,
IndicesService indicesService, SuggestPhase suggestPhase) {
super(settings, threadPool, clusterService, transportService);
super(settings, SuggestAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
this.suggestPhase = suggestPhase;
}
@ -77,11 +77,6 @@ public class TransportSuggestAction extends TransportBroadcastOperationAction<Su
return ThreadPool.Names.SUGGEST;
}
@Override
protected String transportAction() {
return SuggestAction.NAME;
}
@Override
protected SuggestRequest newRequest() {
return new SuggestRequest();

View File

@ -18,11 +18,9 @@
*/
package org.elasticsearch.action.support;
import org.elasticsearch.ElasticsearchIllegalStateException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.BaseTransportRequestHandler;
@ -40,10 +38,9 @@ public abstract class HandledTransportAction<Request extends ActionRequest, Resp
*/
public abstract Request newRequestInstance();
@Inject
public HandledTransportAction(Settings settings, ThreadPool threadPool, TransportService transportService, String actionName){
super(settings,threadPool);
transportService.registerHandler(actionName, new TransportHandler(actionName) {
protected HandledTransportAction(Settings settings, String actionName, ThreadPool threadPool, TransportService transportService){
super(settings, actionName, threadPool);
transportService.registerHandler(actionName, new TransportHandler() {
@Override
public Request newInstance(){
return newRequestInstance();
@ -51,9 +48,7 @@ public abstract class HandledTransportAction<Request extends ActionRequest, Resp
});
}
private abstract class TransportHandler extends BaseTransportRequestHandler<Request>{
private final String actionName;
/**
* Call to get an instance of type Request
@ -61,16 +56,6 @@ public abstract class HandledTransportAction<Request extends ActionRequest, Resp
*/
public abstract Request newInstance();
private TransportHandler(){
throw new ElasticsearchIllegalStateException("Default constructor of " + TransportHandler.class.toString() + " cannot be called");
}
private TransportHandler(String actionName){
this.actionName = actionName;
}
@Override
public final void messageReceived(final Request request, final TransportChannel channel) throws Exception {
// no need to use threaded listener, since we just send a response

View File

@ -35,9 +35,11 @@ import static org.elasticsearch.action.support.PlainActionFuture.newFuture;
public abstract class TransportAction<Request extends ActionRequest, Response extends ActionResponse> 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;
}

View File

@ -50,21 +50,18 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
protected final ClusterService clusterService;
protected final TransportService transportService;
final String transportAction;
final String transportShardAction;
final String executor;
protected TransportBroadcastOperationAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, threadPool);
protected TransportBroadcastOperationAction(Settings settings, String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, actionName, threadPool);
this.clusterService = clusterService;
this.transportService = transportService;
this.threadPool = threadPool;
this.transportAction = transportAction();
this.transportShardAction = transportAction() + "/s";
this.transportShardAction = actionName + "/s";
this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler());
transportService.registerHandler(actionName, new TransportHandler());
transportService.registerHandler(transportShardAction, new ShardTransportHandler());
}
@ -73,8 +70,6 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
new AsyncBroadcastAction(request, listener).start();
}
protected abstract String transportAction();
protected abstract String executor();
protected abstract Request newRequest();

View File

@ -45,22 +45,18 @@ public abstract class TransportMasterNodeOperationAction<Request extends MasterN
protected final ClusterService clusterService;
final String transportAction;
final String executor;
protected TransportMasterNodeOperationAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, threadPool);
protected TransportMasterNodeOperationAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, actionName, threadPool);
this.transportService = transportService;
this.clusterService = clusterService;
this.transportAction = transportAction();
this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler());
transportService.registerHandler(actionName, new TransportHandler());
}
protected abstract String transportAction();
protected abstract String executor();
protected abstract Request newRequest();
@ -186,7 +182,7 @@ public abstract class TransportMasterNodeOperationAction<Request extends MasterN
return;
}
processBeforeDelegationToMaster(request, clusterState);
transportService.sendRequest(nodes.masterNode(), transportAction, request, new BaseTransportResponseHandler<Response>() {
transportService.sendRequest(nodes.masterNode(), actionName, request, new BaseTransportResponseHandler<Response>() {
@Override
public Response newInstance() {
return newResponse();

View File

@ -35,8 +35,8 @@ public abstract class TransportMasterNodeReadOperationAction<Request extends Mas
private Boolean forceLocal;
protected TransportMasterNodeReadOperationAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, transportService, clusterService, threadPool);
protected TransportMasterNodeReadOperationAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
super(settings, actionName, transportService, clusterService, threadPool);
this.forceLocal = settings.getAsBoolean(FORCE_LOCAL_SETTING, null);
}

View File

@ -32,8 +32,8 @@ import org.elasticsearch.transport.TransportService;
*/
public abstract class TransportClusterInfoAction<Request extends ClusterInfoRequest, Response extends ActionResponse> extends TransportMasterNodeReadOperationAction<Request, Response> {
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

View File

@ -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<Request extends NodesOperati
protected final TransportService transportService;
final String transportAction;
final String transportNodeAction;
final String executor;
@Inject
public TransportNodesOperationAction(Settings settings, ClusterName clusterName, ThreadPool threadPool,
protected TransportNodesOperationAction(Settings settings, String actionName, ClusterName clusterName, ThreadPool threadPool,
ClusterService clusterService, TransportService transportService) {
super(settings, threadPool);
super(settings, actionName, threadPool);
this.clusterName = clusterName;
this.clusterService = clusterService;
this.transportService = transportService;
this.transportAction = transportAction();
this.transportNodeAction = transportAction() + "/n";
this.transportNodeAction = actionName + "/n";
this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler());
transportService.registerHandler(actionName, new TransportHandler());
transportService.registerHandler(transportNodeAction, new NodeTransportHandler());
}
@ -73,8 +69,6 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
new AsyncAction(request, listener).start();
}
protected abstract String transportAction();
protected boolean transportCompress() {
return false;
}
@ -267,7 +261,7 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
@Override
public String toString() {
return transportAction;
return actionName;
}
}

View File

@ -31,7 +31,6 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.routing.GroupShardsIterator;
import org.elasticsearch.cluster.routing.ShardIterator;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.BaseTransportRequestHandler;
@ -52,14 +51,13 @@ public abstract class TransportIndexReplicationOperationAction<Request extends I
protected final TransportShardReplicationOperationAction<ShardRequest, ShardReplicaRequest, ShardResponse> shardAction;
@Inject
public TransportIndexReplicationOperationAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
TransportShardReplicationOperationAction<ShardRequest, ShardReplicaRequest, ShardResponse> shardAction) {
super(settings, threadPool);
protected TransportIndexReplicationOperationAction(Settings settings, String actionName, TransportService transportService, ClusterService clusterService,
ThreadPool threadPool, TransportShardReplicationOperationAction<ShardRequest, ShardReplicaRequest, ShardResponse> 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<Request extends I
protected abstract Response newResponseInstance(Request request, List<ShardResponse> shardResponses, int failuresCount, List<ShardOperationFailedException> 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<Request extends I
try {
channel.sendResponse(e);
} catch (Exception e1) {
logger.warn("Failed to send error response for action [" + transportAction() + "] and request [" + request + "]", e1);
logger.warn("Failed to send error response for action [" + actionName + "] and request [" + request + "]", e1);
}
}
});

View File

@ -26,7 +26,6 @@ import org.elasticsearch.action.support.TransportAction;
import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.BaseTransportRequestHandler;
@ -48,19 +47,13 @@ public abstract class TransportIndicesReplicationOperationAction<Request extends
protected final TransportIndexReplicationOperationAction<IndexRequest, IndexResponse, ShardRequest, ShardReplicaRequest, ShardResponse> 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<IndexRequest, IndexResponse, ShardRequest, ShardReplicaRequest, ShardResponse> 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<Request extends
protected abstract Response newResponseInstance(Request request, AtomicReferenceArray indexResponses);
protected abstract String transportAction();
protected abstract IndexRequest newIndexRequestInstance(Request request, String index, Set<String> routing, long startTimeInMillis);
protected abstract boolean accumulateExceptions();
@ -166,7 +157,7 @@ public abstract class TransportIndicesReplicationOperationAction<Request extends
try {
channel.sendResponse(e);
} catch (Exception e1) {
logger.warn("Failed to send error response for action [" + transportAction + "] and request [" + request + "]", e1);
logger.warn("Failed to send error response for action [" + actionName + "] and request [" + request + "]", e1);
}
}
});

View File

@ -71,26 +71,24 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
protected final WriteConsistencyLevel defaultWriteConsistencyLevel;
protected final TransportRequestOptions transportOptions;
final String transportAction;
final String transportReplicaAction;
final String executor;
final boolean checkWriteConsistency;
protected TransportShardReplicationOperationAction(Settings settings, TransportService transportService,
protected TransportShardReplicationOperationAction(Settings settings, String actionName, TransportService transportService,
ClusterService clusterService, IndicesService indicesService,
ThreadPool threadPool, ShardStateAction shardStateAction) {
super(settings, threadPool);
super(settings, actionName, threadPool);
this.transportService = transportService;
this.clusterService = clusterService;
this.indicesService = indicesService;
this.shardStateAction = shardStateAction;
this.transportAction = transportAction();
this.transportReplicaAction = transportReplicaAction();
this.executor = executor();
this.checkWriteConsistency = checkWriteConsistency();
transportService.registerHandler(transportAction, new OperationTransportHandler());
transportService.registerHandler(actionName, new OperationTransportHandler());
transportService.registerHandler(transportReplicaAction, new ReplicaOperationTransportHandler());
this.transportOptions = transportOptions();
@ -110,8 +108,6 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
protected abstract Response newResponseInstance();
protected abstract String transportAction();
protected abstract String executor();
protected abstract PrimaryResponse<Response, ReplicaRequest> shardOperationOnPrimary(ClusterState clusterState, PrimaryOperationRequest shardRequest);
@ -155,7 +151,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
}
private String transportReplicaAction() {
return transportAction() + "/replica";
return actionName + "/replica";
}
protected boolean retryPrimaryException(Throwable e) {
@ -215,7 +211,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
try {
channel.sendResponse(e);
} catch (Throwable e1) {
logger.warn("Failed to send response for " + transportAction, e1);
logger.warn("Failed to send response for " + actionName, e1);
}
}
});
@ -441,7 +437,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
}
} else {
DiscoveryNode node = observer.observedState().nodes().get(shard.currentNodeId());
transportService.sendRequest(node, transportAction, request, transportOptions, new BaseTransportResponseHandler<Response>() {
transportService.sendRequest(node, actionName, request, transportOptions, new BaseTransportResponseHandler<Response>() {
@Override
public Response newInstance() {
@ -695,9 +691,9 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
public void handleException(TransportException exp) {
logger.trace("[{}] Transport failure during replica request [{}] ", exp, node, request);
if (!ignoreReplicaException(exp)) {
logger.warn("Failed to perform " + transportAction + " on remote replica " + node + shardIt.shardId(), exp);
logger.warn("Failed to perform " + actionName + " on remote replica " + node + shardIt.shardId(), exp);
shardStateAction.shardFailed(shard, indexMetaData.getUUID(),
"Failed to perform [" + transportAction + "] on replica, message [" + ExceptionsHelper.detailedMessage(exp) + "]");
"Failed to perform [" + actionName + "] on replica, message [" + ExceptionsHelper.detailedMessage(exp) + "]");
}
finishIfPossible();
}
@ -767,7 +763,7 @@ public abstract class TransportShardReplicationOperationAction<Request extends S
logger.debug("ignoring failed replica [{}][{}] because index was already removed.", index, shardId);
return;
}
indexShard.failShard(transportAction + " failed on replica", t);
indexShard.failShard(actionName + " failed on replica", t);
}
}

View File

@ -47,20 +47,18 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
protected final TransportService transportService;
final String transportAction;
final String transportShardAction;
final String executor;
protected TransportSingleCustomOperationAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, threadPool);
protected TransportSingleCustomOperationAction(Settings settings, String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, actionName, threadPool);
this.clusterService = clusterService;
this.transportService = transportService;
this.transportAction = transportAction();
this.transportShardAction = transportAction() + "/s";
this.transportShardAction = actionName + "/s";
this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler());
transportService.registerHandler(actionName, new TransportHandler());
transportService.registerHandler(transportShardAction, new ShardTransportHandler());
}
@ -69,8 +67,6 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
new AsyncSingleAction(request, listener).start();
}
protected abstract String transportAction();
protected abstract String executor();
/**

View File

@ -51,18 +51,16 @@ public abstract class TransportInstanceSingleOperationAction<Request extends Ins
protected final TransportService transportService;
final String transportAction;
final String executor;
protected TransportInstanceSingleOperationAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, threadPool);
protected TransportInstanceSingleOperationAction(Settings settings, String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, actionName, threadPool);
this.clusterService = clusterService;
this.transportService = transportService;
this.transportAction = transportAction();
this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler());
transportService.registerHandler(actionName, new TransportHandler());
}
@Override
@ -72,8 +70,6 @@ public abstract class TransportInstanceSingleOperationAction<Request extends Ins
protected abstract String executor();
protected abstract String transportAction();
protected abstract void shardOperation(Request request, ActionListener<Response> listener) throws ElasticsearchException;
protected abstract Request newRequest();
@ -212,7 +208,7 @@ public abstract class TransportInstanceSingleOperationAction<Request extends Ins
}
} else {
DiscoveryNode node = nodes.get(shard.currentNodeId());
transportService.sendRequest(node, transportAction, request, transportOptions(), new BaseTransportResponseHandler<Response>() {
transportService.sendRequest(node, actionName, request, transportOptions(), new BaseTransportResponseHandler<Response>() {
@Override
public Response newInstance() {

View File

@ -52,20 +52,18 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
protected final TransportService transportService;
final String transportAction;
final String transportShardAction;
final String executor;
protected TransportShardSingleOperationAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, threadPool);
protected TransportShardSingleOperationAction(Settings settings, String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService) {
super(settings, actionName, threadPool);
this.clusterService = clusterService;
this.transportService = transportService;
this.transportAction = transportAction();
this.transportShardAction = transportAction() + "/s";
this.transportShardAction = actionName + "/s";
this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler());
transportService.registerHandler(actionName, new TransportHandler());
transportService.registerHandler(transportShardAction, new ShardTransportHandler());
}
@ -74,8 +72,6 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
new AsyncSingleAction(request, listener).start();
}
protected abstract String transportAction();
protected abstract String executor();
protected abstract Response shardOperation(Request request, int shardId) throws ElasticsearchException;

View File

@ -47,7 +47,7 @@ public class TransportMultiTermVectorsAction extends TransportAction<MultiTermVe
@Inject
public TransportMultiTermVectorsAction(Settings settings, ThreadPool threadPool, TransportService transportService,
ClusterService clusterService, TransportSingleShardMultiTermsVectorAction shardAction) {
super(settings, threadPool);
super(settings, MultiTermVectorsAction.NAME, threadPool);
this.clusterService = clusterService;
this.shardAction = shardAction;

View File

@ -40,10 +40,12 @@ public class TransportSingleShardMultiTermsVectorAction extends TransportShardSi
private final IndicesService indicesService;
private static final String ACTION_NAME = MultiTermVectorsAction.NAME + "/shard";
@Inject
public TransportSingleShardMultiTermsVectorAction(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;
}
@ -52,11 +54,6 @@ public class TransportSingleShardMultiTermsVectorAction extends TransportShardSi
return ThreadPool.Names.GET;
}
@Override
protected String transportAction() {
return MultiTermVectorsAction.NAME + "/shard";
}
@Override
protected MultiTermVectorsShardRequest newRequest() {
return new MultiTermVectorsShardRequest();

View File

@ -45,7 +45,7 @@ public class TransportSingleShardTermVectorAction extends TransportShardSingleOp
@Inject
public TransportSingleShardTermVectorAction(Settings settings, ClusterService clusterService, TransportService transportService,
IndicesService indicesService, ThreadPool threadPool) {
super(settings, threadPool, clusterService, transportService);
super(settings, TermVectorAction.NAME, threadPool, clusterService, transportService);
this.indicesService = indicesService;
}
@ -55,11 +55,6 @@ public class TransportSingleShardTermVectorAction extends TransportShardSingleOp
return ThreadPool.Names.GET;
}
@Override
protected String transportAction() {
return TermVectorAction.NAME;
}
@Override
protected ClusterBlockException checkGlobalBlock(ClusterState state, TermVectorRequest request) {
return state.blocks().globalBlockedException(ClusterBlockLevel.READ);

View File

@ -73,7 +73,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
public TransportUpdateAction(Settings settings, ThreadPool threadPool, ClusterService clusterService, TransportService transportService,
TransportIndexAction indexAction, TransportDeleteAction deleteAction, TransportCreateIndexAction createIndexAction,
UpdateHelper updateHelper) {
super(settings, threadPool, clusterService, transportService);
super(settings, UpdateAction.NAME, threadPool, clusterService, transportService);
this.indexAction = indexAction;
this.deleteAction = deleteAction;
this.createIndexAction = createIndexAction;
@ -81,11 +81,6 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
this.autoCreateIndex = new AutoCreateIndex(settings);
}
@Override
protected String transportAction() {
return UpdateAction.NAME;
}
@Override
protected String executor() {
return ThreadPool.Names.INDEX;

View File

@ -65,6 +65,8 @@ public class MappingUpdatedAction extends TransportMasterNodeOperationAction<Map
public static final String INDICES_MAPPING_ADDITIONAL_MAPPING_CHANGE_TIME = "indices.mapping.additional_mapping_change_time";
private static final String ACTION_NAME = "cluster/mappingUpdated";
private final AtomicLong mappingUpdateOrderGen = new AtomicLong();
private final MetaDataMappingService metaDataMappingService;
@ -87,7 +89,7 @@ public class MappingUpdatedAction extends TransportMasterNodeOperationAction<Map
@Inject
public MappingUpdatedAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool,
MetaDataMappingService metaDataMappingService, NodeSettingsService nodeSettingsService) {
super(settings, transportService, clusterService, threadPool);
super(settings, ACTION_NAME, transportService, clusterService, threadPool);
this.metaDataMappingService = metaDataMappingService;
// this setting should probably always be 0, just add the option to wait for more changes within a time window
this.additionalMappingChangeTime = settings.getAsTime(INDICES_MAPPING_ADDITIONAL_MAPPING_CHANGE_TIME, TimeValue.timeValueMillis(0));
@ -113,11 +115,6 @@ public class MappingUpdatedAction extends TransportMasterNodeOperationAction<Map
masterMappingUpdater.add(new MappingChange(documentMapper, index, indexUUID, listener));
}
@Override
protected String transportAction() {
return "cluster/mappingUpdated";
}
@Override
protected String executor() {
// we go async right away

Some files were not shown because too many files have changed in this diff Show More