Class TransportSingleShardAction<Request extends SingleShardRequest<Request>,Response extends ActionResponse>
- java.lang.Object
-
- org.elasticsearch.action.support.TransportAction<Request,Response>
-
- org.elasticsearch.action.support.single.shard.TransportSingleShardAction<Request,Response>
-
- Direct Known Subclasses:
RetentionLeaseActions.Add.TransportAction,RetentionLeaseActions.Remove.TransportAction,RetentionLeaseActions.Renew.TransportAction,TransportAnalyzeAction,TransportExplainAction,TransportFieldCapabilitiesIndexAction,TransportGetAction,TransportGetFieldMappingsIndexAction,TransportShardMultiGetAction,TransportShardMultiTermsVectorAction,TransportTermVectorsAction
public abstract class TransportSingleShardAction<Request extends SingleShardRequest<Request>,Response extends ActionResponse> extends TransportAction<Request,Response>
A base class for operations that need to perform a read operation on a single shard copy. If the operation fails, the read operation can be performed on other shard copies. Concrete implementations can provide their own list of candidate shards to try the read operation on.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classTransportSingleShardAction.InternalRequestInternal request class that gets built on each node.
-
Field Summary
Fields Modifier and Type Field Description protected ClusterServiceclusterServiceprotected IndexNameExpressionResolverindexNameExpressionResolverprotected ThreadPoolthreadPoolprotected TransportServicetransportService-
Fields inherited from class org.elasticsearch.action.support.TransportAction
actionName, logger, taskManager
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTransportSingleShardAction(java.lang.String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, java.lang.String executor)
-
Method Summary
Modifier and Type Method Description protected voidasyncShardOperation(Request request, ShardId shardId, ActionListener<Response> listener)protected ClusterBlockExceptioncheckGlobalBlock(ClusterState state)protected ClusterBlockExceptioncheckRequestBlock(ClusterState state, TransportSingleShardAction.InternalRequest request)protected voiddoExecute(Task task, Request request, ActionListener<Response> listener)protected java.lang.StringgetExecutor(Request request, ShardId shardId)protected abstract Writeable.Reader<Response>getResponseReader()protected booleanisSubAction()Tells whether the action is a main one or a subaction.protected abstract booleanresolveIndex(Request request)protected voidresolveRequest(ClusterState state, TransportSingleShardAction.InternalRequest request)protected abstract ResponseshardOperation(Request request, ShardId shardId)protected abstract ShardsIteratorshards(ClusterState state, TransportSingleShardAction.InternalRequest request)Returns the candidate shards to execute the operation on ornullthe execute the operation locally (the node that received the request)-
Methods inherited from class org.elasticsearch.action.support.TransportAction
execute, execute, execute
-
-
-
-
Field Detail
-
threadPool
protected final ThreadPool threadPool
-
clusterService
protected final ClusterService clusterService
-
transportService
protected final TransportService transportService
-
indexNameExpressionResolver
protected final IndexNameExpressionResolver indexNameExpressionResolver
-
-
Constructor Detail
-
TransportSingleShardAction
protected TransportSingleShardAction(java.lang.String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<Request> request, java.lang.String executor)
-
-
Method Detail
-
isSubAction
protected boolean isSubAction()
Tells whether the action is a main one or a subaction. Used to decide whether we need to register the main transport handler. In fact if the action is a subaction, its execute method will be called locally to its parent action.
-
doExecute
protected void doExecute(Task task, Request request, ActionListener<Response> listener)
- Specified by:
doExecutein classTransportAction<Request extends SingleShardRequest<Request>,Response extends ActionResponse>
-
shardOperation
protected abstract Response shardOperation(Request request, ShardId shardId) throws java.io.IOException
- Throws:
java.io.IOException
-
asyncShardOperation
protected void asyncShardOperation(Request request, ShardId shardId, ActionListener<Response> listener) throws java.io.IOException
- Throws:
java.io.IOException
-
getResponseReader
protected abstract Writeable.Reader<Response> getResponseReader()
-
resolveIndex
protected abstract boolean resolveIndex(Request request)
-
checkGlobalBlock
protected ClusterBlockException checkGlobalBlock(ClusterState state)
-
checkRequestBlock
protected ClusterBlockException checkRequestBlock(ClusterState state, TransportSingleShardAction.InternalRequest request)
-
resolveRequest
protected void resolveRequest(ClusterState state, TransportSingleShardAction.InternalRequest request)
-
shards
@Nullable protected abstract ShardsIterator shards(ClusterState state, TransportSingleShardAction.InternalRequest request)
Returns the candidate shards to execute the operation on ornullthe execute the operation locally (the node that received the request)
-
-