Core: Combine doExecute methods in TransportAction (#31517)
TransportAction currently contains 2 doExecute methods, one which takes a the task, and one that does not. The latter is what some subclasses implement, while the first one just calls the latter, dropping the given task. This commit combines these methods, in favor of just always assuming a task is present.
This commit is contained in:
parent
2ba50dbf50
commit
49387bf2d7
|
@ -30,6 +30,7 @@ import org.elasticsearch.action.update.UpdateResponse;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportNoopBulkAction extends HandledTransportAction<BulkRequest, BulkResponse> {
|
||||
|
@ -42,7 +43,7 @@ public class TransportNoopBulkAction extends HandledTransportAction<BulkRequest,
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(BulkRequest request, ActionListener<BulkResponse> listener) {
|
||||
protected void doExecute(Task task, BulkRequest request, ActionListener<BulkResponse> listener) {
|
||||
final int itemCount = request.requests().size();
|
||||
// simulate at least a realistic amount of data that gets serialized
|
||||
BulkItemResponse[] bulkItemResponses = new BulkItemResponse[itemCount];
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.internal.InternalSearchResponse;
|
||||
import org.elasticsearch.search.profile.SearchProfileShardResults;
|
||||
import org.elasticsearch.search.suggest.Suggest;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.Collections;
|
||||
|
@ -44,7 +45,7 @@ public class TransportNoopSearchAction extends HandledTransportAction<SearchRequ
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SearchRequest request, ActionListener<SearchResponse> listener) {
|
||||
protected void doExecute(Task task, SearchRequest request, ActionListener<SearchResponse> listener) {
|
||||
listener.onResponse(new SearchResponse(new InternalSearchResponse(
|
||||
new SearchHits(
|
||||
new SearchHit[0], 0L, 0.0f),
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.elasticsearch.rest.RestController;
|
|||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.rest.RestResponse;
|
||||
import org.elasticsearch.rest.action.RestBuilderListener;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -118,7 +119,7 @@ public class GrokProcessorGetAction extends Action<GrokProcessorGetAction.Respon
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Request request, ActionListener<Response> listener) {
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
try {
|
||||
listener.onResponse(new Response(GROK_PATTERNS));
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -54,7 +55,7 @@ public class TransportMultiSearchTemplateAction extends HandledTransportAction<M
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(MultiSearchTemplateRequest request, ActionListener<MultiSearchTemplateResponse> listener) {
|
||||
protected void doExecute(Task task, MultiSearchTemplateRequest request, ActionListener<MultiSearchTemplateResponse> listener) {
|
||||
List<Integer> originalSlots = new ArrayList<>();
|
||||
MultiSearchRequest multiSearchRequest = new MultiSearchRequest();
|
||||
multiSearchRequest.indicesOptions(request.indicesOptions());
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.elasticsearch.script.ScriptService;
|
|||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.script.TemplateScript;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -63,7 +64,7 @@ public class TransportSearchTemplateAction extends HandledTransportAction<Search
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SearchTemplateRequest request, ActionListener<SearchTemplateResponse> listener) {
|
||||
protected void doExecute(Task task, SearchTemplateRequest request, ActionListener<SearchTemplateResponse> listener) {
|
||||
final SearchTemplateResponse response = new SearchTemplateResponse();
|
||||
try {
|
||||
SearchRequest searchRequest = convert(request, response, scriptService, xContentRegistry);
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.elasticsearch.script.Script;
|
|||
import org.elasticsearch.script.ScriptContext;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.elasticsearch.script.ScriptType;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -285,7 +286,7 @@ public class PainlessExecuteAction extends Action<PainlessExecuteAction.Response
|
|||
this.scriptService = scriptService;
|
||||
}
|
||||
@Override
|
||||
protected void doExecute(Request request, ActionListener<Response> listener) {
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
switch (request.context) {
|
||||
case PAINLESS_TEST:
|
||||
PainlessTestScript.Factory factory = scriptService.compile(request.script, PainlessTestScript.CONTEXT);
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.elasticsearch.script.ScriptService;
|
|||
import org.elasticsearch.script.TemplateScript;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -83,7 +84,7 @@ public class TransportRankEvalAction extends HandledTransportAction<RankEvalRequ
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(RankEvalRequest request, ActionListener<RankEvalResponse> listener) {
|
||||
protected void doExecute(Task task, RankEvalRequest request, ActionListener<RankEvalResponse> listener) {
|
||||
RankEvalSpec evaluationSpecification = request.getRankEvalSpec();
|
||||
EvaluationMetric metric = evaluationSpecification.getMetric();
|
||||
|
||||
|
|
|
@ -67,9 +67,4 @@ public class TransportDeleteByQueryAction extends HandledTransportAction<DeleteB
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteByQueryRequest request, ActionListener<BulkByScrollResponse> listener) {
|
||||
throw new UnsupportedOperationException("task required");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -134,11 +134,6 @@ public class TransportReindexAction extends HandledTransportAction<ReindexReques
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ReindexRequest request, ActionListener<BulkByScrollResponse> listener) {
|
||||
throw new UnsupportedOperationException("task required");
|
||||
}
|
||||
|
||||
static void checkRemoteWhitelist(CharacterRunAutomaton whitelist, RemoteInfo remoteInfo) {
|
||||
if (remoteInfo == null) {
|
||||
return;
|
||||
|
|
|
@ -78,11 +78,6 @@ public class TransportUpdateByQueryAction extends HandledTransportAction<UpdateB
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(UpdateByQueryRequest request, ActionListener<BulkByScrollResponse> listener) {
|
||||
throw new UnsupportedOperationException("task required");
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple implementation of update-by-query using scrolling and bulk.
|
||||
*/
|
||||
|
|
|
@ -81,11 +81,6 @@ public class TransportGetTaskAction extends HandledTransportAction<GetTaskReques
|
|||
this.xContentRegistry = xContentRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetTaskRequest request, ActionListener<GetTaskResponse> listener) {
|
||||
throw new UnsupportedOperationException("Task is required");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task thisTask, GetTaskRequest request, ActionListener<GetTaskResponse> listener) {
|
||||
if (clusterService.localNode().getId().equals(request.getTaskId().getNodeId())) {
|
||||
|
|
|
@ -22,6 +22,7 @@ package org.elasticsearch.action.admin.cluster.remote;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.RemoteClusterService;
|
||||
import org.elasticsearch.action.search.SearchTransportService;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
|
@ -45,7 +46,7 @@ public final class TransportRemoteInfoAction extends HandledTransportAction<Remo
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(RemoteInfoRequest remoteInfoRequest, ActionListener<RemoteInfoResponse> listener) {
|
||||
protected void doExecute(Task task, RemoteInfoRequest remoteInfoRequest, ActionListener<RemoteInfoResponse> listener) {
|
||||
listener.onResponse(new RemoteInfoResponse(remoteClusterService.getRemoteConnectionInfos().collect(toList())));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.indices.flush.SyncedFlushService;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
/**
|
||||
|
@ -45,7 +46,7 @@ public class TransportSyncedFlushAction extends HandledTransportAction<SyncedFlu
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SyncedFlushRequest request, ActionListener<SyncedFlushResponse> listener) {
|
||||
protected void doExecute(Task task, SyncedFlushRequest request, ActionListener<SyncedFlushResponse> listener) {
|
||||
syncedFlushService.attemptSyncedFlush(request.indices(), request.indicesOptions(), listener);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -53,7 +54,7 @@ public class TransportGetFieldMappingsAction extends HandledTransportAction<GetF
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetFieldMappingsRequest request, final ActionListener<GetFieldMappingsResponse> listener) {
|
||||
protected void doExecute(Task task, GetFieldMappingsRequest request, final ActionListener<GetFieldMappingsResponse> listener) {
|
||||
ClusterState clusterState = clusterService.state();
|
||||
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNames(clusterState, request);
|
||||
final AtomicInteger indexCounter = new AtomicInteger();
|
||||
|
|
|
@ -123,11 +123,6 @@ public class TransportBulkAction extends HandledTransportAction<BulkRequest, Bul
|
|||
clusterService.addStateApplier(this.ingestForwarder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doExecute(final BulkRequest bulkRequest, final ActionListener<BulkResponse> listener) {
|
||||
throw new UnsupportedOperationException("task parameter is required for this operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, BulkRequest bulkRequest, ActionListener<BulkResponse> listener) {
|
||||
if (bulkRequest.hasIndexRequestsWithPipelines()) {
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.elasticsearch.search.internal.SearchContext;
|
|||
import org.elasticsearch.search.internal.ShardSearchLocalRequest;
|
||||
import org.elasticsearch.search.rescore.RescoreContext;
|
||||
import org.elasticsearch.search.rescore.Rescorer;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -67,9 +68,9 @@ public class TransportExplainAction extends TransportSingleShardAction<ExplainRe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ExplainRequest request, ActionListener<ExplainResponse> listener) {
|
||||
protected void doExecute(Task task, ExplainRequest request, ActionListener<ExplainResponse> listener) {
|
||||
request.nowInMillis = System.currentTimeMillis();
|
||||
super.doExecute(request, listener);
|
||||
super.doExecute(task, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.CountDown;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.RemoteClusterAware;
|
||||
import org.elasticsearch.transport.RemoteClusterService;
|
||||
|
@ -63,8 +64,7 @@ public class TransportFieldCapabilitiesAction extends HandledTransportAction<Fie
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(FieldCapabilitiesRequest request,
|
||||
final ActionListener<FieldCapabilitiesResponse> listener) {
|
||||
protected void doExecute(Task task, FieldCapabilitiesRequest request, final ActionListener<FieldCapabilitiesResponse> listener) {
|
||||
final ClusterState clusterState = clusterService.state();
|
||||
final Map<String, OriginalIndices> remoteClusterIndices = remoteClusterService.groupIndices(request.indicesOptions(),
|
||||
request.indices(), idx -> indexNameExpressionResolver.hasIndexOrAlias(idx, clusterState));
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.AtomicArray;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -53,7 +54,7 @@ public class TransportMultiGetAction extends HandledTransportAction<MultiGetRequ
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final MultiGetRequest request, final ActionListener<MultiGetResponse> listener) {
|
||||
protected void doExecute(Task task, final MultiGetRequest request, final ActionListener<MultiGetResponse> listener) {
|
||||
ClusterState clusterState = clusterService.state();
|
||||
clusterState.blocks().globalBlockedRaiseException(ClusterBlockLevel.READ);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.XContentHelper;
|
||||
import org.elasticsearch.ingest.PipelineStore;
|
||||
import org.elasticsearch.node.NodeService;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class SimulatePipelineTransportAction extends HandledTransportAction<Simu
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SimulatePipelineRequest request, ActionListener<SimulatePipelineResponse> listener) {
|
||||
protected void doExecute(Task task, SimulatePipelineRequest request, ActionListener<SimulatePipelineResponse> listener) {
|
||||
final Map<String, Object> source = XContentHelper.convertToMap(request.getSource(), false, request.getXContentType()).v2();
|
||||
|
||||
final SimulatePipelineRequest.Parsed simulateRequest;
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportMainAction extends HandledTransportAction<MainRequest, MainResponse> {
|
||||
|
@ -44,7 +45,7 @@ public class TransportMainAction extends HandledTransportAction<MainRequest, Mai
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(MainRequest request, ActionListener<MainResponse> listener) {
|
||||
protected void doExecute(Task task, MainRequest request, ActionListener<MainResponse> listener) {
|
||||
ClusterState clusterState = clusterService.state();
|
||||
assert Node.NODE_NAME_SETTING.exists(settings);
|
||||
final boolean available = clusterState.getBlocks().hasGlobalBlock(RestStatus.SERVICE_UNAVAILABLE) == false;
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportClearScrollAction extends HandledTransportAction<ClearScrollRequest, ClearScrollResponse> {
|
||||
|
@ -43,7 +44,7 @@ public class TransportClearScrollAction extends HandledTransportAction<ClearScro
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ClearScrollRequest request, final ActionListener<ClearScrollResponse> listener) {
|
||||
protected void doExecute(Task task, ClearScrollRequest request, final ActionListener<ClearScrollResponse> listener) {
|
||||
Runnable runnable = new ClearScrollController(request, listener, clusterService.state().nodes(), logger, searchTransportService);
|
||||
runnable.run();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.AtomicArray;
|
||||
import org.elasticsearch.common.util.concurrent.EsExecutors;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -70,7 +71,7 @@ public class TransportMultiSearchAction extends HandledTransportAction<MultiSear
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(MultiSearchRequest request, ActionListener<MultiSearchResponse> listener) {
|
||||
protected void doExecute(Task task, MultiSearchRequest request, ActionListener<MultiSearchResponse> listener) {
|
||||
final long relativeStartTime = relativeTimeProvider.getAsLong();
|
||||
|
||||
ClusterState clusterState = clusterService.state();
|
||||
|
|
|
@ -362,11 +362,6 @@ public class TransportSearchAction extends HandledTransportAction<SearchRequest,
|
|||
return new GroupShardsIterator<>(shards);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doExecute(SearchRequest searchRequest, ActionListener<SearchResponse> listener) {
|
||||
throw new UnsupportedOperationException("the task parameter is required");
|
||||
}
|
||||
|
||||
private AbstractSearchAsyncAction searchAsyncAction(SearchTask task, SearchRequest searchRequest,
|
||||
GroupShardsIterator<SearchShardIterator> shardIterators,
|
||||
SearchTimeProvider timeProvider,
|
||||
|
|
|
@ -50,10 +50,6 @@ public class TransportSearchScrollAction extends HandledTransportAction<SearchSc
|
|||
this.searchPhaseController = searchPhaseController;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doExecute(SearchScrollRequest request, ActionListener<SearchResponse> listener) {
|
||||
throw new UnsupportedOperationException("the task parameter is required");
|
||||
}
|
||||
@Override
|
||||
protected void doExecute(Task task, SearchScrollRequest request, ActionListener<SearchResponse> listener) {
|
||||
try {
|
||||
|
|
|
@ -123,11 +123,7 @@ public abstract class TransportAction<Request extends ActionRequest, Response ex
|
|||
requestFilterChain.proceed(task, actionName, request, listener);
|
||||
}
|
||||
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
doExecute(request, listener);
|
||||
}
|
||||
|
||||
protected abstract void doExecute(Request request, ActionListener<Response> listener);
|
||||
protected abstract void doExecute(Task task, Request request, ActionListener<Response> listener);
|
||||
|
||||
private static class RequestFilterChain<Request extends ActionRequest, Response extends ActionResponse>
|
||||
implements ActionFilterChain<Request, Response> {
|
||||
|
|
|
@ -75,11 +75,6 @@ public abstract class TransportBroadcastAction<Request extends BroadcastRequest<
|
|||
new AsyncBroadcastAction(task, request, listener).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doExecute(Request request, ActionListener<Response> listener) {
|
||||
throw new UnsupportedOperationException("the task parameter is required for this operation");
|
||||
}
|
||||
|
||||
protected abstract Response newResponse(Request request, AtomicReferenceArray shardsResponses, ClusterState clusterState);
|
||||
|
||||
protected abstract ShardRequest newShardRequest(int numShards, ShardRouting shard, Request request);
|
||||
|
|
|
@ -221,11 +221,6 @@ public abstract class TransportBroadcastByNodeAction<Request extends BroadcastRe
|
|||
*/
|
||||
protected abstract ClusterBlockException checkRequestBlock(ClusterState state, Request request, String[] concreteIndices);
|
||||
|
||||
@Override
|
||||
protected final void doExecute(Request request, ActionListener<Response> listener) {
|
||||
throw new UnsupportedOperationException("the task parameter is required for this operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
new AsyncAction(task, request, listener).start();
|
||||
|
|
|
@ -115,12 +115,6 @@ public abstract class TransportMasterNodeAction<Request extends MasterNodeReques
|
|||
|
||||
protected abstract ClusterBlockException checkBlock(Request request, ClusterState state);
|
||||
|
||||
@Override
|
||||
protected final void doExecute(final Request request, ActionListener<Response> listener) {
|
||||
logger.warn("attempt to execute a master node operation without task");
|
||||
throw new UnsupportedOperationException("task parameter is required for this operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, final Request request, ActionListener<Response> listener) {
|
||||
new AsyncSingleAction(task, request, listener).start();
|
||||
|
|
|
@ -77,12 +77,6 @@ public abstract class TransportNodesAction<NodesRequest extends BaseNodesRequest
|
|||
transportNodeAction, nodeRequest, nodeExecutor, new NodeTransportHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doExecute(NodesRequest request, ActionListener<NodesResponse> listener) {
|
||||
logger.warn("attempt to execute a transport nodes operation without a task");
|
||||
throw new UnsupportedOperationException("task parameter is required for this operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, NodesRequest request, ActionListener<NodesResponse> listener) {
|
||||
new AsyncAction(task, request, listener).start();
|
||||
|
|
|
@ -66,12 +66,6 @@ public abstract class TransportBroadcastReplicationAction<Request extends Broadc
|
|||
this.indexNameExpressionResolver = indexNameExpressionResolver;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected final void doExecute(final Request request, final ActionListener<Response> listener) {
|
||||
throw new UnsupportedOperationException("the task parameter is required for this operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
final ClusterState clusterState = clusterService.state();
|
||||
|
|
|
@ -163,11 +163,6 @@ public abstract class TransportReplicationAction<
|
|||
new ReplicaOperationTransportHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doExecute(Request request, ActionListener<Response> listener) {
|
||||
throw new UnsupportedOperationException("the task parameter is required for this operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
new ReroutePhase((ReplicationTask) task, request, listener).run();
|
||||
|
|
|
@ -74,7 +74,7 @@ public abstract class TransportInstanceSingleOperationAction<Request extends Ins
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Request request, ActionListener<Response> listener) {
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
new AsyncSingleAction(request, listener).start();
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ public abstract class TransportSingleShardAction<Request extends SingleShardRequ
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Request request, ActionListener<Response> listener) {
|
||||
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
|
||||
new AsyncSingleAction(request, listener).start();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,12 +90,6 @@ public abstract class TransportTasksAction<
|
|||
transportService.registerRequestHandler(transportNodeAction, NodeTaskRequest::new, nodeExecutor, new NodeTransportHandler());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doExecute(TasksRequest request, ActionListener<TasksResponse> listener) {
|
||||
logger.warn("attempt to execute a transport tasks operation without a task");
|
||||
throw new UnsupportedOperationException("task parameter is required for this operation");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Task task, TasksRequest request, ActionListener<TasksResponse> listener) {
|
||||
new AsyncAction(task, request, listener).start();
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.util.concurrent.AtomicArray;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -54,7 +55,7 @@ public class TransportMultiTermVectorsAction extends HandledTransportAction<Mult
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final MultiTermVectorsRequest request, final ActionListener<MultiTermVectorsResponse> listener) {
|
||||
protected void doExecute(Task task, final MultiTermVectorsRequest request, final ActionListener<MultiTermVectorsResponse> listener) {
|
||||
ClusterState clusterState = clusterService.state();
|
||||
|
||||
clusterState.blocks().globalBlockedRaiseException(ClusterBlockLevel.READ);
|
||||
|
|
|
@ -53,6 +53,7 @@ import org.elasticsearch.index.shard.IndexShard;
|
|||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.ResourceAlreadyExistsException;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -111,13 +112,13 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final UpdateRequest request, final ActionListener<UpdateResponse> listener) {
|
||||
protected void doExecute(Task task, final UpdateRequest request, final ActionListener<UpdateResponse> listener) {
|
||||
// if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API
|
||||
if (autoCreateIndex.shouldAutoCreate(request.index(), clusterService.state())) {
|
||||
client.admin().indices().create(new CreateIndexRequest().index(request.index()).cause("auto(update api)").masterNodeTimeout(request.timeout()), new ActionListener<CreateIndexResponse>() {
|
||||
@Override
|
||||
public void onResponse(CreateIndexResponse result) {
|
||||
innerExecute(request, listener);
|
||||
innerExecute(task, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,7 +126,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
if (unwrapCause(e) instanceof ResourceAlreadyExistsException) {
|
||||
// we have the index, do it
|
||||
try {
|
||||
innerExecute(request, listener);
|
||||
innerExecute(task, request, listener);
|
||||
} catch (Exception inner) {
|
||||
inner.addSuppressed(e);
|
||||
listener.onFailure(inner);
|
||||
|
@ -136,12 +137,12 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
}
|
||||
});
|
||||
} else {
|
||||
innerExecute(request, listener);
|
||||
innerExecute(task, request, listener);
|
||||
}
|
||||
}
|
||||
|
||||
private void innerExecute(final UpdateRequest request, final ActionListener<UpdateResponse> listener) {
|
||||
super.doExecute(request, listener);
|
||||
private void innerExecute(final Task task, final UpdateRequest request, final ActionListener<UpdateResponse> listener) {
|
||||
super.doExecute(task, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.elasticsearch.rest.RestHandler;
|
|||
import org.elasticsearch.rest.RestRequest;
|
||||
import org.elasticsearch.rest.RestRequest.Method;
|
||||
import org.elasticsearch.rest.action.RestMainAction;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.tasks.TaskManager;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.threadpool.TestThreadPool;
|
||||
|
@ -84,7 +85,7 @@ public class ActionModuleTests extends ESTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(FakeRequest request, ActionListener<ActionResponse> listener) {
|
||||
protected void doExecute(Task task, FakeRequest request, ActionListener<ActionResponse> listener) {
|
||||
}
|
||||
}
|
||||
class FakeAction extends Action<ActionResponse> {
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.cluster.block.ClusterBlocks;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class MainActionTests extends ESTestCase {
|
|||
x -> null, null, Collections.emptySet());
|
||||
TransportMainAction action = new TransportMainAction(settings, transportService, mock(ActionFilters.class), clusterService);
|
||||
AtomicReference<MainResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(new MainRequest(), new ActionListener<MainResponse>() {
|
||||
action.doExecute(mock(Task.class), new MainRequest(), new ActionListener<MainResponse>() {
|
||||
@Override
|
||||
public void onResponse(MainResponse mainResponse) {
|
||||
responseRef.set(mainResponse);
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.elasticsearch.common.Randomness;
|
|||
import org.elasticsearch.common.UUIDs;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.AtomicArray;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.tasks.TaskManager;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.threadpool.TestThreadPool;
|
||||
|
@ -106,7 +107,7 @@ public class MultiSearchActionTookTests extends ESTestCase {
|
|||
|
||||
TransportMultiSearchAction action = createTransportMultiSearchAction(controlledClock, expected);
|
||||
|
||||
action.doExecute(multiSearchRequest, new ActionListener<MultiSearchResponse>() {
|
||||
action.doExecute(mock(Task.class), multiSearchRequest, new ActionListener<MultiSearchResponse>() {
|
||||
@Override
|
||||
public void onResponse(MultiSearchResponse multiSearchResponse) {
|
||||
if (controlledClock) {
|
||||
|
|
|
@ -83,7 +83,7 @@ public class TransportActionFilterChainTests extends ESTestCase {
|
|||
new TransportAction<TestRequest, TestResponse>(Settings.EMPTY, actionName, actionFilters,
|
||||
new TaskManager(Settings.EMPTY, threadPool, Collections.emptySet())) {
|
||||
@Override
|
||||
protected void doExecute(TestRequest request, ActionListener<TestResponse> listener) {
|
||||
protected void doExecute(Task task, TestRequest request, ActionListener<TestResponse> listener) {
|
||||
listener.onResponse(new TestResponse());
|
||||
}
|
||||
};
|
||||
|
@ -160,7 +160,7 @@ public class TransportActionFilterChainTests extends ESTestCase {
|
|||
TransportAction<TestRequest, TestResponse> transportAction = new TransportAction<TestRequest, TestResponse>(Settings.EMPTY,
|
||||
actionName, actionFilters, new TaskManager(Settings.EMPTY, threadPool, Collections.emptySet())) {
|
||||
@Override
|
||||
protected void doExecute(TestRequest request, ActionListener<TestResponse> listener) {
|
||||
protected void doExecute(Task task, TestRequest request, ActionListener<TestResponse> listener) {
|
||||
listener.onResponse(new TestResponse());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.action.support.TransportAction;
|
|||
import org.elasticsearch.client.AbstractClientHeadersTestCase;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.tasks.TaskManager;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
||||
|
@ -63,7 +64,7 @@ public class NodeClientHeadersTests extends AbstractClientHeadersTestCase {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ActionRequest request, ActionListener listener) {
|
||||
protected void doExecute(Task task, ActionRequest request, ActionListener listener) {
|
||||
listener.onFailure(new InternalException(actionName));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.elasticsearch.license.LicenseService;
|
|||
import org.elasticsearch.license.XPackInfoResponse;
|
||||
import org.elasticsearch.license.XPackInfoResponse.FeatureSetsInfo.FeatureSet;
|
||||
import org.elasticsearch.license.XPackInfoResponse.LicenseInfo;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.XPackBuild;
|
||||
import org.elasticsearch.xpack.core.XPackFeatureSet;
|
||||
|
@ -37,7 +38,7 @@ public class TransportXPackInfoAction extends HandledTransportAction<XPackInfoRe
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(XPackInfoRequest request, ActionListener<XPackInfoResponse> listener) {
|
||||
protected void doExecute(Task task, XPackInfoRequest request, ActionListener<XPackInfoResponse> listener) {
|
||||
|
||||
|
||||
XPackInfoResponse.BuildInfo buildInfo = null;
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ssl.SSLService;
|
||||
import org.elasticsearch.xpack.core.ssl.cert.CertificateInfo;
|
||||
|
@ -32,7 +33,7 @@ public class TransportGetCertificateInfoAction extends HandledTransportAction<Ge
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetCertificateInfoAction.Request request,
|
||||
protected void doExecute(Task task, GetCertificateInfoAction.Request request,
|
||||
ActionListener<GetCertificateInfoAction.Response> listener) {
|
||||
try {
|
||||
Collection<CertificateInfo> certificates = sslService.getLoadedCertificates();
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.license.License;
|
|||
import org.elasticsearch.license.LicenseService;
|
||||
import org.elasticsearch.license.XPackInfoResponse;
|
||||
import org.elasticsearch.license.XPackInfoResponse.FeatureSetsInfo.FeatureSet;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.XPackFeatureSet;
|
||||
|
@ -82,7 +83,7 @@ public class TransportXPackInfoActionTests extends ESTestCase {
|
|||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
final AtomicReference<XPackInfoResponse> response = new AtomicReference<>();
|
||||
final AtomicReference<Throwable> error = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<XPackInfoResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<XPackInfoResponse>() {
|
||||
@Override
|
||||
public void onResponse(XPackInfoResponse infoResponse) {
|
||||
response.set(infoResponse);
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
|
|||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.XPackField;
|
||||
|
@ -92,7 +93,7 @@ public class TransportGraphExploreAction extends HandledTransportAction<GraphExp
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GraphExploreRequest request, ActionListener<GraphExploreResponse> listener) {
|
||||
protected void doExecute(Task task, GraphExploreRequest request, ActionListener<GraphExploreResponse> listener) {
|
||||
if (licenseState.isGraphAllowed()) {
|
||||
new AsyncGraphAction(request, listener).start();
|
||||
} else {
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.index.reindex.DeleteByQueryAction;
|
||||
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.action.DeleteCalendarAction;
|
||||
|
@ -47,7 +48,7 @@ public class TransportDeleteCalendarAction extends HandledTransportAction<Delete
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteCalendarAction.Request request, ActionListener<DeleteCalendarAction.Response> listener) {
|
||||
protected void doExecute(Task task, DeleteCalendarAction.Request request, ActionListener<DeleteCalendarAction.Response> listener) {
|
||||
|
||||
final String calendarId = request.getCalendarId();
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.elasticsearch.client.Client;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.action.DeleteCalendarEventAction;
|
||||
|
@ -50,7 +51,8 @@ public class TransportDeleteCalendarEventAction extends HandledTransportAction<D
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteCalendarEventAction.Request request, ActionListener<DeleteCalendarEventAction.Response> listener) {
|
||||
protected void doExecute(Task task, DeleteCalendarEventAction.Request request,
|
||||
ActionListener<DeleteCalendarEventAction.Response> listener) {
|
||||
final String eventId = request.getEventId();
|
||||
|
||||
ActionListener<Calendar> calendarListener = ActionListener.wrap(
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.client.Client;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ClientHelper;
|
||||
|
@ -46,7 +47,8 @@ public class TransportDeleteExpiredDataAction extends HandledTransportAction<Del
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteExpiredDataAction.Request request, ActionListener<DeleteExpiredDataAction.Response> listener) {
|
||||
protected void doExecute(Task task, DeleteExpiredDataAction.Request request,
|
||||
ActionListener<DeleteExpiredDataAction.Response> listener) {
|
||||
logger.info("Deleting expired data");
|
||||
threadPool.executor(MachineLearning.UTILITY_THREAD_POOL_NAME).execute(() -> deleteExpiredData(listener));
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetadata;
|
||||
|
@ -52,7 +53,7 @@ public class TransportDeleteFilterAction extends HandledTransportAction<DeleteFi
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteFilterAction.Request request, ActionListener<DeleteFilterAction.Response> listener) {
|
||||
protected void doExecute(Task task, DeleteFilterAction.Request request, ActionListener<DeleteFilterAction.Response> listener) {
|
||||
|
||||
final String filterId = request.getFilterId();
|
||||
ClusterState state = clusterService.state();
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.elasticsearch.client.Client;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.DeleteModelSnapshotAction;
|
||||
import org.elasticsearch.xpack.core.ml.job.config.Job;
|
||||
|
@ -47,7 +48,8 @@ public class TransportDeleteModelSnapshotAction extends HandledTransportAction<D
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteModelSnapshotAction.Request request, ActionListener<DeleteModelSnapshotAction.Response> listener) {
|
||||
protected void doExecute(Task task, DeleteModelSnapshotAction.Request request,
|
||||
ActionListener<DeleteModelSnapshotAction.Response> listener) {
|
||||
// Verify the snapshot exists
|
||||
jobProvider.modelSnapshots(
|
||||
request.getJobId(), 0, 1, null, null, null, true, request.getSnapshotId(),
|
||||
|
|
|
@ -11,6 +11,7 @@ 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.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetBucketsAction;
|
||||
import org.elasticsearch.xpack.ml.job.JobManager;
|
||||
|
@ -36,7 +37,7 @@ public class TransportGetBucketsAction extends HandledTransportAction<GetBuckets
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetBucketsAction.Request request, ActionListener<GetBucketsAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetBucketsAction.Request request, ActionListener<GetBucketsAction.Response> listener) {
|
||||
jobManager.getJobOrThrowIfUnknown(request.getJobId());
|
||||
|
||||
BucketsQueryBuilder query =
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.cluster.ClusterState;
|
|||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetadata;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetCalendarEventsAction;
|
||||
|
@ -43,7 +44,7 @@ public class TransportGetCalendarEventsAction extends HandledTransportAction<Get
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetCalendarEventsAction.Request request,
|
||||
protected void doExecute(Task task, GetCalendarEventsAction.Request request,
|
||||
ActionListener<GetCalendarEventsAction.Response> listener) {
|
||||
ActionListener<Boolean> calendarExistsListener = ActionListener.wrap(
|
||||
r -> {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetCalendarsAction;
|
||||
import org.elasticsearch.xpack.core.ml.action.util.PageParams;
|
||||
|
@ -33,7 +34,7 @@ public class TransportGetCalendarsAction extends HandledTransportAction<GetCalen
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetCalendarsAction.Request request, ActionListener<GetCalendarsAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetCalendarsAction.Request request, ActionListener<GetCalendarsAction.Response> listener) {
|
||||
final String calendarId = request.getCalendarId();
|
||||
if (request.getCalendarId() != null && GetCalendarsAction.Request.ALL.equals(request.getCalendarId()) == false) {
|
||||
getCalendar(calendarId, listener);
|
||||
|
|
|
@ -11,6 +11,7 @@ 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.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetCategoriesAction;
|
||||
import org.elasticsearch.xpack.ml.job.JobManager;
|
||||
|
@ -35,7 +36,7 @@ public class TransportGetCategoriesAction extends HandledTransportAction<GetCate
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetCategoriesAction.Request request, ActionListener<GetCategoriesAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetCategoriesAction.Request request, ActionListener<GetCategoriesAction.Response> listener) {
|
||||
jobManager.getJobOrThrowIfUnknown(request.getJobId());
|
||||
|
||||
Integer from = request.getPageParams() != null ? request.getPageParams().getFrom() : null;
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.elasticsearch.common.xcontent.XContentType;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetFiltersAction;
|
||||
|
@ -56,7 +57,7 @@ public class TransportGetFiltersAction extends HandledTransportAction<GetFilters
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetFiltersAction.Request request, ActionListener<GetFiltersAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetFiltersAction.Request request, ActionListener<GetFiltersAction.Response> listener) {
|
||||
final String filterId = request.getFilterId();
|
||||
if (!Strings.isNullOrEmpty(filterId)) {
|
||||
getFilter(filterId, listener);
|
||||
|
|
|
@ -11,6 +11,7 @@ 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.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetInfluencersAction;
|
||||
import org.elasticsearch.xpack.ml.job.JobManager;
|
||||
|
@ -36,7 +37,7 @@ public class TransportGetInfluencersAction extends HandledTransportAction<GetInf
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetInfluencersAction.Request request, ActionListener<GetInfluencersAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetInfluencersAction.Request request, ActionListener<GetInfluencersAction.Response> listener) {
|
||||
jobManager.getJobOrThrowIfUnknown(request.getJobId());
|
||||
|
||||
InfluencersQueryBuilder.InfluencersQuery query = new InfluencersQueryBuilder()
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetModelSnapshotsAction;
|
||||
import org.elasticsearch.xpack.core.ml.action.util.QueryPage;
|
||||
|
@ -35,7 +36,8 @@ public class TransportGetModelSnapshotsAction extends HandledTransportAction<Get
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetModelSnapshotsAction.Request request, ActionListener<GetModelSnapshotsAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetModelSnapshotsAction.Request request,
|
||||
ActionListener<GetModelSnapshotsAction.Response> listener) {
|
||||
logger.debug("Get model snapshots for job {} snapshot ID {}. from = {}, size = {}"
|
||||
+ " start = '{}', end='{}', sort={} descending={}",
|
||||
request.getJobId(), request.getSnapshotId(), request.getPageParams().getFrom(), request.getPageParams().getSize(),
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
|||
import org.elasticsearch.search.aggregations.metrics.max.Max;
|
||||
import org.elasticsearch.search.aggregations.metrics.min.Min;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetOverallBucketsAction;
|
||||
|
@ -74,7 +75,8 @@ public class TransportGetOverallBucketsAction extends HandledTransportAction<Get
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetOverallBucketsAction.Request request, ActionListener<GetOverallBucketsAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetOverallBucketsAction.Request request,
|
||||
ActionListener<GetOverallBucketsAction.Response> listener) {
|
||||
QueryPage<Job> jobsPage = jobManager.expandJobs(request.getJobId(), request.allowNoJobs(), clusterService.state());
|
||||
if (jobsPage.count() == 0) {
|
||||
listener.onResponse(new GetOverallBucketsAction.Response());
|
||||
|
|
|
@ -11,6 +11,7 @@ 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.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.GetRecordsAction;
|
||||
import org.elasticsearch.xpack.ml.job.JobManager;
|
||||
|
@ -36,7 +37,7 @@ public class TransportGetRecordsAction extends HandledTransportAction<GetRecords
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetRecordsAction.Request request, ActionListener<GetRecordsAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetRecordsAction.Request request, ActionListener<GetRecordsAction.Response> listener) {
|
||||
|
||||
jobManager.getJobOrThrowIfUnknown(request.getJobId());
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.ByteSizeUnit;
|
||||
import org.elasticsearch.common.unit.ByteSizeValue;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MachineLearningField;
|
||||
import org.elasticsearch.xpack.core.ml.action.MlInfoAction;
|
||||
|
@ -37,7 +38,7 @@ public class TransportMlInfoAction extends HandledTransportAction<MlInfoAction.R
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(MlInfoAction.Request request, ActionListener<MlInfoAction.Response> listener) {
|
||||
protected void doExecute(Task task, MlInfoAction.Request request, ActionListener<MlInfoAction.Response> listener) {
|
||||
Map<String, Object> info = new HashMap<>();
|
||||
info.put("defaults", defaults());
|
||||
info.put("limits", limits());
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.action.PostCalendarEventsAction;
|
||||
|
@ -53,7 +54,7 @@ public class TransportPostCalendarEventsAction extends HandledTransportAction<Po
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(PostCalendarEventsAction.Request request,
|
||||
protected void doExecute(Task task, PostCalendarEventsAction.Request request,
|
||||
ActionListener<PostCalendarEventsAction.Response> listener) {
|
||||
List<ScheduledEvent> events = request.getScheduledEvents();
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.elasticsearch.cluster.service.ClusterService;
|
|||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ClientHelper;
|
||||
|
@ -51,7 +52,7 @@ public class TransportPreviewDatafeedAction extends HandledTransportAction<Previ
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(PreviewDatafeedAction.Request request, ActionListener<PreviewDatafeedAction.Response> listener) {
|
||||
protected void doExecute(Task task, PreviewDatafeedAction.Request request, ActionListener<PreviewDatafeedAction.Response> listener) {
|
||||
MlMetadata mlMetadata = MlMetadata.getMlMetadata(clusterService.state());
|
||||
DatafeedConfig datafeed = mlMetadata.getDatafeed(request.getDatafeedId());
|
||||
if (datafeed == null) {
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.elasticsearch.common.xcontent.ToXContent;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.action.PutCalendarAction;
|
||||
|
@ -46,7 +47,7 @@ public class TransportPutCalendarAction extends HandledTransportAction<PutCalend
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(PutCalendarAction.Request request, ActionListener<PutCalendarAction.Response> listener) {
|
||||
protected void doExecute(Task task, PutCalendarAction.Request request, ActionListener<PutCalendarAction.Response> listener) {
|
||||
Calendar calendar = request.getCalendar();
|
||||
|
||||
IndexRequest indexRequest = new IndexRequest(MlMetaIndex.INDEX_NAME, MlMetaIndex.TYPE, calendar.documentId());
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.elasticsearch.common.xcontent.ToXContent;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.action.PutFilterAction;
|
||||
|
@ -46,7 +47,7 @@ public class TransportPutFilterAction extends HandledTransportAction<PutFilterAc
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(PutFilterAction.Request request, ActionListener<PutFilterAction.Response> listener) {
|
||||
protected void doExecute(Task task, PutFilterAction.Request request, ActionListener<PutFilterAction.Response> listener) {
|
||||
MlFilter filter = request.getFilter();
|
||||
IndexRequest indexRequest = new IndexRequest(MlMetaIndex.INDEX_NAME, MlMetaIndex.TYPE, filter.documentId());
|
||||
indexRequest.opType(DocWriteRequest.OpType.CREATE);
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.PutCalendarAction;
|
||||
import org.elasticsearch.xpack.core.ml.action.UpdateCalendarJobAction;
|
||||
|
@ -33,7 +34,7 @@ public class TransportUpdateCalendarJobAction extends HandledTransportAction<Upd
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(UpdateCalendarJobAction.Request request, ActionListener<PutCalendarAction.Response> listener) {
|
||||
protected void doExecute(Task task, UpdateCalendarJobAction.Request request, ActionListener<PutCalendarAction.Response> listener) {
|
||||
Set<String> jobIdsToAdd = Strings.tokenizeByCommaToSet(request.getJobIdsToAddExpression());
|
||||
Set<String> jobIdsToRemove = Strings.tokenizeByCommaToSet(request.getJobIdsToRemoveExpression());
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
|||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.engine.VersionConflictEngineException;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.MlMetaIndex;
|
||||
import org.elasticsearch.xpack.core.ml.action.PutFilterAction;
|
||||
|
@ -62,7 +63,7 @@ public class TransportUpdateFilterAction extends HandledTransportAction<UpdateFi
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(UpdateFilterAction.Request request, ActionListener<PutFilterAction.Response> listener) {
|
||||
protected void doExecute(Task task, UpdateFilterAction.Request request, ActionListener<PutFilterAction.Response> listener) {
|
||||
ActionListener<FilterWithVersion> filterListener = ActionListener.wrap(filterWithVersion -> {
|
||||
updateFilter(filterWithVersion, request, listener);
|
||||
}, listener::onFailure);
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.UpdateModelSnapshotAction;
|
||||
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
|
||||
|
@ -50,7 +51,8 @@ public class TransportUpdateModelSnapshotAction extends HandledTransportAction<U
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(UpdateModelSnapshotAction.Request request, ActionListener<UpdateModelSnapshotAction.Response> listener) {
|
||||
protected void doExecute(Task task, UpdateModelSnapshotAction.Request request,
|
||||
ActionListener<UpdateModelSnapshotAction.Response> listener) {
|
||||
logger.debug("Received request to update model snapshot [{}] for job [{}]", request.getSnapshotId(), request.getJobId());
|
||||
jobProvider.getModelSnapshot(request.getJobId(), request.getSnapshotId(), modelSnapshot -> {
|
||||
if (modelSnapshot == null) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.ValidateDetectorAction;
|
||||
|
||||
|
@ -25,7 +26,7 @@ public class TransportValidateDetectorAction extends HandledTransportAction<Vali
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ValidateDetectorAction.Request request, ActionListener<ValidateDetectorAction.Response> listener) {
|
||||
protected void doExecute(Task task, ValidateDetectorAction.Request request, ActionListener<ValidateDetectorAction.Response> listener) {
|
||||
listener.onResponse(new ValidateDetectorAction.Response(true));
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.ml.action.ValidateJobConfigAction;
|
||||
|
||||
|
@ -25,7 +26,8 @@ public class TransportValidateJobConfigAction extends HandledTransportAction<Val
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ValidateJobConfigAction.Request request, ActionListener<ValidateJobConfigAction.Response> listener) {
|
||||
protected void doExecute(Task task, ValidateJobConfigAction.Request request,
|
||||
ActionListener<ValidateJobConfigAction.Response> listener) {
|
||||
listener.onResponse(new ValidateJobConfigAction.Response(true));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.elasticsearch.common.bytes.BytesReference;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.monitoring.MonitoredSystem;
|
||||
|
@ -51,7 +52,7 @@ public class TransportMonitoringBulkAction extends HandledTransportAction<Monito
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(MonitoringBulkRequest request, ActionListener<MonitoringBulkResponse> listener) {
|
||||
protected void doExecute(Task task, MonitoringBulkRequest request, ActionListener<MonitoringBulkResponse> listener) {
|
||||
clusterService.state().blocks().globalBlockedRaiseException(ClusterBlockLevel.WRITE);
|
||||
|
||||
// ignore incoming bulk requests when collection is disabled in ES
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.elasticsearch.common.bytes.BytesArray;
|
|||
import org.elasticsearch.common.collect.ImmutableOpenMap;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.rollup.RollupField;
|
||||
import org.elasticsearch.xpack.core.rollup.action.GetRollupCapsAction;
|
||||
|
@ -42,7 +43,7 @@ public class TransportGetRollupCapsAction extends HandledTransportAction<GetRoll
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(GetRollupCapsAction.Request request, ActionListener<GetRollupCapsAction.Response> listener) {
|
||||
protected void doExecute(Task task, GetRollupCapsAction.Request request, ActionListener<GetRollupCapsAction.Response> listener) {
|
||||
|
||||
Map<String, RollableIndexCaps> allCaps = getCaps(request.getIndexPattern(), clusterService.state().getMetaData().indices());
|
||||
listener.onResponse(new GetRollupCapsAction.Response(allCaps));
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TransportRollupSearchAction extends TransportAction<SearchRequest,
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SearchRequest request, ActionListener<SearchResponse> listener) {
|
||||
protected void doExecute(Task task, SearchRequest request, ActionListener<SearchResponse> listener) {
|
||||
RollupSearchContext rollupSearchContext = separateIndices(request.indices(),
|
||||
clusterService.state().getMetaData().indices());
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.role.DeleteRoleAction;
|
||||
import org.elasticsearch.xpack.core.security.action.role.DeleteRoleRequest;
|
||||
|
@ -31,7 +32,7 @@ public class TransportDeleteRoleAction extends HandledTransportAction<DeleteRole
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteRoleRequest request, ActionListener<DeleteRoleResponse> listener) {
|
||||
protected void doExecute(Task task, DeleteRoleRequest request, ActionListener<DeleteRoleResponse> listener) {
|
||||
if (ReservedRolesStore.isReserved(request.name())) {
|
||||
listener.onFailure(new IllegalArgumentException("role [" + request.name() + "] is reserved and cannot be deleted"));
|
||||
return;
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.role.GetRolesAction;
|
||||
import org.elasticsearch.xpack.core.security.action.role.GetRolesRequest;
|
||||
|
@ -37,7 +38,7 @@ public class TransportGetRolesAction extends HandledTransportAction<GetRolesRequ
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final GetRolesRequest request, final ActionListener<GetRolesResponse> listener) {
|
||||
protected void doExecute(Task task, final GetRolesRequest request, final ActionListener<GetRolesResponse> listener) {
|
||||
final String[] requestedRoles = request.names();
|
||||
final boolean specificRolesRequested = requestedRoles != null && requestedRoles.length > 0;
|
||||
final List<String> rolesToSearchFor = new ArrayList<>();
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.role.PutRoleAction;
|
||||
import org.elasticsearch.xpack.core.security.action.role.PutRoleRequest;
|
||||
|
@ -29,7 +30,7 @@ public class TransportPutRoleAction extends HandledTransportAction<PutRoleReques
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final PutRoleRequest request, final ActionListener<PutRoleResponse> listener) {
|
||||
protected void doExecute(Task task, final PutRoleRequest request, final ActionListener<PutRoleResponse> listener) {
|
||||
final String name = request.roleDescriptor().getName();
|
||||
if (ReservedRolesStore.isReserved(name)) {
|
||||
listener.onFailure(new IllegalArgumentException("role [" + name + "] is reserved and cannot be modified."));
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.DeleteRoleMappingAction;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.DeleteRoleMappingRequest;
|
||||
|
@ -30,8 +31,7 @@ public class TransportDeleteRoleMappingAction
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteRoleMappingRequest request,
|
||||
ActionListener<DeleteRoleMappingResponse> listener) {
|
||||
protected void doExecute(Task task, DeleteRoleMappingRequest request, ActionListener<DeleteRoleMappingResponse> listener) {
|
||||
roleMappingStore.deleteRoleMapping(request, new ActionListener<Boolean>() {
|
||||
@Override
|
||||
public void onResponse(Boolean found) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.GetRoleMappingsAction;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.GetRoleMappingsRequest;
|
||||
|
@ -35,8 +36,7 @@ public class TransportGetRoleMappingsAction
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final GetRoleMappingsRequest request,
|
||||
final ActionListener<GetRoleMappingsResponse> listener) {
|
||||
protected void doExecute(Task task, final GetRoleMappingsRequest request, final ActionListener<GetRoleMappingsResponse> listener) {
|
||||
final Set<String> names;
|
||||
if (request.getNames() == null || request.getNames().length == 0) {
|
||||
names = null;
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.PutRoleMappingAction;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.PutRoleMappingRequest;
|
||||
|
@ -30,8 +31,7 @@ public class TransportPutRoleMappingAction
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final PutRoleMappingRequest request,
|
||||
final ActionListener<PutRoleMappingResponse> listener) {
|
||||
protected void doExecute(Task task, final PutRoleMappingRequest request, final ActionListener<PutRoleMappingResponse> listener) {
|
||||
roleMappingStore.putRoleMapping(request, ActionListener.wrap(
|
||||
created -> listener.onResponse(new PutRoleMappingResponse(created)),
|
||||
listener::onFailure
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.saml.SamlAuthenticateAction;
|
||||
|
@ -46,8 +47,7 @@ public final class TransportSamlAuthenticateAction extends HandledTransportActio
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SamlAuthenticateRequest request,
|
||||
ActionListener<SamlAuthenticateResponse> listener) {
|
||||
protected void doExecute(Task task, SamlAuthenticateRequest request, ActionListener<SamlAuthenticateResponse> listener) {
|
||||
final SamlToken saml = new SamlToken(request.getSaml(), request.getValidRequestIds());
|
||||
logger.trace("Attempting to authenticate SamlToken [{}]", saml);
|
||||
final ThreadContext threadContext = threadPool.getThreadContext();
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.elasticsearch.common.Strings;
|
|||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.saml.SamlInvalidateSessionAction;
|
||||
import org.elasticsearch.xpack.core.security.action.saml.SamlInvalidateSessionRequest;
|
||||
|
@ -54,8 +55,7 @@ public final class TransportSamlInvalidateSessionAction
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SamlInvalidateSessionRequest request,
|
||||
ActionListener<SamlInvalidateSessionResponse> listener) {
|
||||
protected void doExecute(Task task, SamlInvalidateSessionRequest request, ActionListener<SamlInvalidateSessionResponse> listener) {
|
||||
List<SamlRealm> realms = findSamlRealms(this.realms, request.getRealmName(), request.getAssertionConsumerServiceURL());
|
||||
if (realms.isEmpty()) {
|
||||
listener.onFailure(SamlUtils.samlException("Cannot find any matching realm for [{}]", request));
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.saml.SamlLogoutAction;
|
||||
import org.elasticsearch.xpack.core.security.action.saml.SamlLogoutRequest;
|
||||
|
@ -48,8 +49,7 @@ public final class TransportSamlLogoutAction
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SamlLogoutRequest request,
|
||||
ActionListener<SamlLogoutResponse> listener) {
|
||||
protected void doExecute(Task task, SamlLogoutRequest request, ActionListener<SamlLogoutResponse> listener) {
|
||||
invalidateRefreshToken(request.getRefreshToken(), ActionListener.wrap(ignore -> {
|
||||
try {
|
||||
final String token = request.getToken();
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.saml.SamlPrepareAuthenticationAction;
|
||||
import org.elasticsearch.xpack.core.security.action.saml.SamlPrepareAuthenticationRequest;
|
||||
|
@ -42,7 +43,7 @@ public final class TransportSamlPrepareAuthenticationAction
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SamlPrepareAuthenticationRequest request,
|
||||
protected void doExecute(Task task, SamlPrepareAuthenticationRequest request,
|
||||
ActionListener<SamlPrepareAuthenticationResponse> listener) {
|
||||
List<SamlRealm> realms = findSamlRealms(this.realms, request.getRealmName(), request.getAssertionConsumerServiceURL());
|
||||
if (realms.isEmpty()) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
|||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.token.CreateTokenAction;
|
||||
|
@ -46,7 +47,7 @@ public final class TransportCreateTokenAction extends HandledTransportAction<Cre
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(CreateTokenRequest request, ActionListener<CreateTokenResponse> listener) {
|
||||
protected void doExecute(Task task, CreateTokenRequest request, ActionListener<CreateTokenResponse> listener) {
|
||||
Authentication originatingAuthentication = Authentication.getAuthentication(threadPool.getThreadContext());
|
||||
try (ThreadContext.StoredContext ignore = threadPool.getThreadContext().stashContext()) {
|
||||
final UsernamePasswordToken authToken = new UsernamePasswordToken(request.getUsername(), request.getPassword());
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.token.InvalidateTokenAction;
|
||||
import org.elasticsearch.xpack.core.security.action.token.InvalidateTokenRequest;
|
||||
|
@ -32,7 +33,7 @@ public final class TransportInvalidateTokenAction extends HandledTransportAction
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(InvalidateTokenRequest request, ActionListener<InvalidateTokenResponse> listener) {
|
||||
protected void doExecute(Task task, InvalidateTokenRequest request, ActionListener<InvalidateTokenResponse> listener) {
|
||||
final ActionListener<Boolean> invalidateListener =
|
||||
ActionListener.wrap(created -> listener.onResponse(new InvalidateTokenResponse(created)), listener::onFailure);
|
||||
if (request.getTokenType() == InvalidateTokenRequest.Type.ACCESS_TOKEN) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.token.CreateTokenRequest;
|
||||
import org.elasticsearch.xpack.core.security.action.token.CreateTokenResponse;
|
||||
|
@ -30,7 +31,7 @@ public class TransportRefreshTokenAction extends HandledTransportAction<CreateTo
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(CreateTokenRequest request, ActionListener<CreateTokenResponse> listener) {
|
||||
protected void doExecute(Task task, CreateTokenRequest request, ActionListener<CreateTokenResponse> listener) {
|
||||
tokenService.refreshToken(request.getRefreshToken(), ActionListener.wrap(tuple -> {
|
||||
final String tokenStr = tokenService.getUserTokenString(tuple.v1());
|
||||
final String scope = getResponseScopeValue(request.getScope());
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.SecurityContext;
|
||||
import org.elasticsearch.xpack.core.security.action.user.AuthenticateAction;
|
||||
|
@ -35,7 +36,7 @@ public class TransportAuthenticateAction extends HandledTransportAction<Authenti
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(AuthenticateRequest request, ActionListener<AuthenticateResponse> listener) {
|
||||
protected void doExecute(Task task, AuthenticateRequest request, ActionListener<AuthenticateResponse> listener) {
|
||||
final User runAsUser = securityContext.getUser();
|
||||
final User authUser = runAsUser == null ? null : runAsUser.authenticatedUser();
|
||||
if (authUser == null) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.user.ChangePasswordAction;
|
||||
import org.elasticsearch.xpack.core.security.action.user.ChangePasswordRequest;
|
||||
|
@ -31,7 +32,7 @@ public class TransportChangePasswordAction extends HandledTransportAction<Change
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(ChangePasswordRequest request, ActionListener<ChangePasswordResponse> listener) {
|
||||
protected void doExecute(Task task, ChangePasswordRequest request, ActionListener<ChangePasswordResponse> listener) {
|
||||
final String username = request.username();
|
||||
if (AnonymousUser.isAnonymousUsername(username, settings)) {
|
||||
listener.onFailure(new IllegalArgumentException("user [" + username + "] is anonymous and cannot be modified via the API"));
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.user.DeleteUserAction;
|
||||
import org.elasticsearch.xpack.core.security.action.user.DeleteUserRequest;
|
||||
|
@ -35,7 +36,7 @@ public class TransportDeleteUserAction extends HandledTransportAction<DeleteUser
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(DeleteUserRequest request, final ActionListener<DeleteUserResponse> listener) {
|
||||
protected void doExecute(Task task, DeleteUserRequest request, final ActionListener<DeleteUserResponse> listener) {
|
||||
final String username = request.username();
|
||||
if (ClientReservedRealm.isReserved(username, settings)) {
|
||||
if (AnonymousUser.isAnonymousUsername(username, settings)) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.elasticsearch.action.support.GroupedActionListener;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.user.GetUsersAction;
|
||||
import org.elasticsearch.xpack.core.security.action.user.GetUsersRequest;
|
||||
|
@ -43,7 +44,7 @@ public class TransportGetUsersAction extends HandledTransportAction<GetUsersRequ
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final GetUsersRequest request, final ActionListener<GetUsersResponse> listener) {
|
||||
protected void doExecute(Task task, final GetUsersRequest request, final ActionListener<GetUsersResponse> listener) {
|
||||
final String[] requestedUsers = request.usernames();
|
||||
final boolean specificUsersRequested = requestedUsers != null && requestedUsers.length > 0;
|
||||
final List<String> usersToSearchFor = new ArrayList<>();
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.elasticsearch.action.support.HandledTransportAction;
|
|||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.user.HasPrivilegesAction;
|
||||
|
@ -55,7 +56,7 @@ public class TransportHasPrivilegesAction extends HandledTransportAction<HasPriv
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(HasPrivilegesRequest request, ActionListener<HasPrivilegesResponse> listener) {
|
||||
protected void doExecute(Task task, HasPrivilegesRequest request, ActionListener<HasPrivilegesResponse> listener) {
|
||||
final String username = request.username();
|
||||
|
||||
final User user = Authentication.getAuthentication(threadPool.getThreadContext()).getUser();
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.user.PutUserAction;
|
||||
import org.elasticsearch.xpack.core.security.action.user.PutUserRequest;
|
||||
|
@ -34,7 +35,7 @@ public class TransportPutUserAction extends HandledTransportAction<PutUserReques
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(final PutUserRequest request, final ActionListener<PutUserResponse> listener) {
|
||||
protected void doExecute(Task task, final PutUserRequest request, final ActionListener<PutUserResponse> listener) {
|
||||
final String username = request.username();
|
||||
if (ClientReservedRealm.isReserved(username, settings)) {
|
||||
if (AnonymousUser.isAnonymousUsername(username, settings)) {
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.user.SetEnabledAction;
|
||||
|
@ -38,7 +39,7 @@ public class TransportSetEnabledAction extends HandledTransportAction<SetEnabled
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(SetEnabledRequest request, ActionListener<SetEnabledResponse> listener) {
|
||||
protected void doExecute(Task task, SetEnabledRequest request, ActionListener<SetEnabledResponse> listener) {
|
||||
final String username = request.username();
|
||||
// make sure the user is not disabling themselves
|
||||
if (Authentication.getAuthentication(threadPool.getThreadContext()).getUser().principal().equals(request.username())) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.elasticsearch.ElasticsearchSecurityException;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.role.DeleteRoleRequest;
|
||||
|
@ -51,7 +52,7 @@ public class TransportDeleteRoleActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<DeleteRoleResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<DeleteRoleResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<DeleteRoleResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteRoleResponse deleteRoleResponse) {
|
||||
responseRef.set(deleteRoleResponse);
|
||||
|
@ -94,7 +95,7 @@ public class TransportDeleteRoleActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<DeleteRoleResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<DeleteRoleResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<DeleteRoleResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteRoleResponse deleteRoleResponse) {
|
||||
responseRef.set(deleteRoleResponse);
|
||||
|
@ -138,7 +139,7 @@ public class TransportDeleteRoleActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<DeleteRoleResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<DeleteRoleResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<DeleteRoleResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteRoleResponse deleteRoleResponse) {
|
||||
responseRef.set(deleteRoleResponse);
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.role.GetRolesRequest;
|
||||
|
@ -64,7 +65,7 @@ public class TransportGetRolesActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<GetRolesResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<GetRolesResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<GetRolesResponse>() {
|
||||
@Override
|
||||
public void onResponse(GetRolesResponse response) {
|
||||
responseRef.set(response);
|
||||
|
@ -105,7 +106,7 @@ public class TransportGetRolesActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<GetRolesResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<GetRolesResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<GetRolesResponse>() {
|
||||
@Override
|
||||
public void onResponse(GetRolesResponse response) {
|
||||
responseRef.set(response);
|
||||
|
@ -173,7 +174,7 @@ public class TransportGetRolesActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<GetRolesResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<GetRolesResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<GetRolesResponse>() {
|
||||
@Override
|
||||
public void onResponse(GetRolesResponse response) {
|
||||
responseRef.set(response);
|
||||
|
@ -221,7 +222,7 @@ public class TransportGetRolesActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<GetRolesResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<GetRolesResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<GetRolesResponse>() {
|
||||
@Override
|
||||
public void onResponse(GetRolesResponse response) {
|
||||
responseRef.set(response);
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.elasticsearch.ElasticsearchSecurityException;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.role.PutRoleRequest;
|
||||
|
@ -51,7 +52,7 @@ public class TransportPutRoleActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<PutRoleResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<PutRoleResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<PutRoleResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutRoleResponse response) {
|
||||
responseRef.set(response);
|
||||
|
@ -93,7 +94,7 @@ public class TransportPutRoleActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<PutRoleResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<PutRoleResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<PutRoleResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutRoleResponse response) {
|
||||
responseRef.set(response);
|
||||
|
@ -135,7 +136,7 @@ public class TransportPutRoleActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<PutRoleResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(request, new ActionListener<PutRoleResponse>() {
|
||||
action.doExecute(mock(Task.class), request, new ActionListener<PutRoleResponse>() {
|
||||
@Override
|
||||
public void onResponse(PutRoleResponse response) {
|
||||
responseRef.set(response);
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.GetRoleMappingsRequest;
|
||||
|
@ -67,7 +68,7 @@ public class TransportGetRoleMappingsActionTests extends ESTestCase {
|
|||
|
||||
final ExpressionRoleMapping mapping = mock(ExpressionRoleMapping.class);
|
||||
result = Collections.singletonList(mapping);
|
||||
action.doExecute(request, future);
|
||||
action.doExecute(mock(Task.class), request, future);
|
||||
assertThat(future.get(), notNullValue());
|
||||
assertThat(future.get().mappings(), arrayContaining(mapping));
|
||||
assertThat(namesRef.get(), containsInAnyOrder("everyone"));
|
||||
|
@ -83,7 +84,7 @@ public class TransportGetRoleMappingsActionTests extends ESTestCase {
|
|||
final ExpressionRoleMapping mapping3 = mock(ExpressionRoleMapping.class);
|
||||
result = Arrays.asList(mapping1, mapping2, mapping3);
|
||||
|
||||
action.doExecute(request, future);
|
||||
action.doExecute(mock(Task.class), request, future);
|
||||
|
||||
final GetRoleMappingsResponse response = future.get();
|
||||
assertThat(response, notNullValue());
|
||||
|
@ -101,7 +102,7 @@ public class TransportGetRoleMappingsActionTests extends ESTestCase {
|
|||
final ExpressionRoleMapping mapping3 = mock(ExpressionRoleMapping.class);
|
||||
result = Arrays.asList(mapping1, mapping2, mapping3);
|
||||
|
||||
action.doExecute(request, future);
|
||||
action.doExecute(mock(Task.class), request, future);
|
||||
|
||||
final GetRoleMappingsResponse response = future.get();
|
||||
assertThat(response, notNullValue());
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.action.rolemapping.PutRoleMappingRequest;
|
||||
|
@ -84,7 +85,7 @@ public class TransportPutRoleMappingActionTests extends ESTestCase {
|
|||
request.setMetadata(metadata);
|
||||
request.setEnabled(true);
|
||||
final PlainActionFuture<PutRoleMappingResponse> future = new PlainActionFuture<>();
|
||||
action.doExecute(request, future);
|
||||
action.doExecute(mock(Task.class), request, future);
|
||||
return future.get();
|
||||
}
|
||||
}
|
|
@ -42,6 +42,7 @@ import org.elasticsearch.index.query.QueryBuilder;
|
|||
import org.elasticsearch.index.query.TermQueryBuilder;
|
||||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ClusterServiceUtils;
|
||||
import org.elasticsearch.test.client.NoOpClient;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
@ -240,7 +241,7 @@ public class TransportSamlInvalidateSessionActionTests extends SamlTestCase {
|
|||
request.setRealmName(samlRealm.name());
|
||||
request.setQueryString("SAMLRequest=foo");
|
||||
final PlainActionFuture<SamlInvalidateSessionResponse> future = new PlainActionFuture<>();
|
||||
action.doExecute(request, future);
|
||||
action.doExecute(mock(Task.class), request, future);
|
||||
final SamlInvalidateSessionResponse response = future.get();
|
||||
assertThat(response, notNullValue());
|
||||
assertThat(response.getCount(), equalTo(2));
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.TestEnvironment;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ClusterServiceUtils;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
@ -228,7 +229,7 @@ public class TransportSamlLogoutActionTests extends SamlTestCase {
|
|||
final SamlLogoutRequest request = new SamlLogoutRequest();
|
||||
request.setToken(tokenString);
|
||||
final PlainActionFuture<SamlLogoutResponse> listener = new PlainActionFuture<>();
|
||||
action.doExecute(request, listener);
|
||||
action.doExecute(mock(Task.class), request, listener);
|
||||
final SamlLogoutResponse response = listener.get();
|
||||
assertThat(response, notNullValue());
|
||||
assertThat(response.getRedirectUrl(), notNullValue());
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.elasticsearch.ElasticsearchSecurityException;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.tasks.Task;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
import org.elasticsearch.xpack.core.security.SecurityContext;
|
||||
|
@ -43,7 +44,7 @@ public class TransportAuthenticateActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<AuthenticateResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(new AuthenticateRequest(), new ActionListener<AuthenticateResponse>() {
|
||||
action.doExecute(mock(Task.class), new AuthenticateRequest(), new ActionListener<AuthenticateResponse>() {
|
||||
@Override
|
||||
public void onResponse(AuthenticateResponse authenticateResponse) {
|
||||
responseRef.set(authenticateResponse);
|
||||
|
@ -69,7 +70,7 @@ public class TransportAuthenticateActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<AuthenticateResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(new AuthenticateRequest(), new ActionListener<AuthenticateResponse>() {
|
||||
action.doExecute(mock(Task.class), new AuthenticateRequest(), new ActionListener<AuthenticateResponse>() {
|
||||
@Override
|
||||
public void onResponse(AuthenticateResponse authenticateResponse) {
|
||||
responseRef.set(authenticateResponse);
|
||||
|
@ -97,7 +98,7 @@ public class TransportAuthenticateActionTests extends ESTestCase {
|
|||
|
||||
final AtomicReference<Throwable> throwableRef = new AtomicReference<>();
|
||||
final AtomicReference<AuthenticateResponse> responseRef = new AtomicReference<>();
|
||||
action.doExecute(new AuthenticateRequest(), new ActionListener<AuthenticateResponse>() {
|
||||
action.doExecute(mock(Task.class), new AuthenticateRequest(), new ActionListener<AuthenticateResponse>() {
|
||||
@Override
|
||||
public void onResponse(AuthenticateResponse authenticateResponse) {
|
||||
responseRef.set(authenticateResponse);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue