Class TransportTasksAction<OperationTask extends Task,TasksRequest extends BaseTasksRequest<TasksRequest>,TasksResponse extends BaseTasksResponse,TaskResponse extends Writeable>
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.action.support.TransportAction<Request,Response>
-
- org.elasticsearch.action.support.HandledTransportAction<TasksRequest,TasksResponse>
-
- org.elasticsearch.action.support.tasks.TransportTasksAction<OperationTask,TasksRequest,TasksResponse,TaskResponse>
-
- Direct Known Subclasses:
TransportCancelTasksAction
,TransportListTasksAction
public abstract class TransportTasksAction<OperationTask extends Task,TasksRequest extends BaseTasksRequest<TasksRequest>,TasksResponse extends BaseTasksResponse,TaskResponse extends Writeable> extends HandledTransportAction<TasksRequest,TasksResponse>
The base class for transport actions that are interacting with currently running tasks.
-
-
Field Summary
Fields Modifier and Type Field Description protected ClusterService
clusterService
protected Writeable.Reader<TasksRequest>
requestSupplier
protected java.util.function.Supplier<TasksResponse>
responseSupplier
protected java.lang.String
transportNodeAction
protected TransportService
transportService
-
Fields inherited from class org.elasticsearch.action.support.TransportAction
actionName, indexNameExpressionResolver, taskManager, threadPool
-
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
logger
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
TransportTasksAction(Settings settings, java.lang.String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<TasksRequest> requestSupplier, java.util.function.Supplier<TasksResponse> responseSupplier, java.lang.String nodeExecutor)
-
Method Summary
Modifier and Type Method Description protected void
doExecute(Task task, TasksRequest request, ActionListener<TasksResponse> listener)
protected void
doExecute(TasksRequest request, ActionListener<TasksResponse> listener)
protected java.lang.String[]
filterNodeIds(DiscoveryNodes nodes, java.lang.String[] nodesIds)
protected TasksResponse
newResponse(TasksRequest request, java.util.concurrent.atomic.AtomicReferenceArray responses)
protected abstract TasksResponse
newResponse(TasksRequest request, java.util.List<TaskResponse> tasks, java.util.List<TaskOperationFailure> taskOperationFailures, java.util.List<FailedNodeException> failedNodeExceptions)
protected void
processTasks(TasksRequest request, java.util.function.Consumer<OperationTask> operation)
protected abstract TaskResponse
readTaskResponse(StreamInput in)
protected java.lang.String[]
resolveNodes(TasksRequest request, ClusterState clusterState)
protected abstract void
taskOperation(TasksRequest request, OperationTask task, ActionListener<TaskResponse> listener)
Perform the required operation on the task.-
Methods inherited from class org.elasticsearch.action.support.TransportAction
execute, execute, execute, execute
-
-
-
-
Field Detail
-
clusterService
protected final ClusterService clusterService
-
transportService
protected final TransportService transportService
-
requestSupplier
protected final Writeable.Reader<TasksRequest extends BaseTasksRequest<TasksRequest>> requestSupplier
-
responseSupplier
protected final java.util.function.Supplier<TasksResponse extends BaseTasksResponse> responseSupplier
-
transportNodeAction
protected final java.lang.String transportNodeAction
-
-
Constructor Detail
-
TransportTasksAction
protected TransportTasksAction(Settings settings, java.lang.String actionName, ThreadPool threadPool, ClusterService clusterService, TransportService transportService, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, Writeable.Reader<TasksRequest> requestSupplier, java.util.function.Supplier<TasksResponse> responseSupplier, java.lang.String nodeExecutor)
-
-
Method Detail
-
doExecute
protected final void doExecute(TasksRequest request, ActionListener<TasksResponse> listener)
- Specified by:
doExecute
in classTransportAction<TasksRequest extends BaseTasksRequest<TasksRequest>,TasksResponse extends BaseTasksResponse>
-
doExecute
protected void doExecute(Task task, TasksRequest request, ActionListener<TasksResponse> listener)
- Overrides:
doExecute
in classTransportAction<TasksRequest extends BaseTasksRequest<TasksRequest>,TasksResponse extends BaseTasksResponse>
-
filterNodeIds
protected java.lang.String[] filterNodeIds(DiscoveryNodes nodes, java.lang.String[] nodesIds)
-
resolveNodes
protected java.lang.String[] resolveNodes(TasksRequest request, ClusterState clusterState)
-
processTasks
protected void processTasks(TasksRequest request, java.util.function.Consumer<OperationTask> operation)
-
newResponse
protected abstract TasksResponse newResponse(TasksRequest request, java.util.List<TaskResponse> tasks, java.util.List<TaskOperationFailure> taskOperationFailures, java.util.List<FailedNodeException> failedNodeExceptions)
-
newResponse
protected TasksResponse newResponse(TasksRequest request, java.util.concurrent.atomic.AtomicReferenceArray responses)
-
readTaskResponse
protected abstract TaskResponse readTaskResponse(StreamInput in) throws java.io.IOException
- Throws:
java.io.IOException
-
taskOperation
protected abstract void taskOperation(TasksRequest request, OperationTask task, ActionListener<TaskResponse> listener)
Perform the required operation on the task. It is OK start an asynchronous operation or to throw an exception but not both.
-
-