Internal: made it possible to disable the main transport handler in TransportShardSingleOperationAction
TransportShardSingleOperationAction is currently subclassed by different transport actions. Some of them are internal only, meaning that their execution will take place only in the same node where their parent execution took place. That means that their main transport handler doesn't need to be registered, the only transport handler that's needed is the shard level one. Added `isSubAction` method (defaults to false) to the parent class that tells whether the action is a main one or a subaction, used to decide whether we need to register the main transport handler. Closes #7285
This commit is contained in:
parent
9c63abde04
commit
a279f2e8c6
|
@ -57,6 +57,11 @@ public class TransportShardMultiGetAction extends TransportShardSingleOperationA
|
|||
this.realtime = settings.getAsBoolean("action.get.realtime", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSubAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String executor() {
|
||||
return ThreadPool.Names.GET;
|
||||
|
|
|
@ -59,6 +59,11 @@ public class TransportShardMultiPercolateAction extends TransportShardSingleOper
|
|||
this.percolatorService = percolatorService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSubAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String executor() {
|
||||
return ThreadPool.Names.PERCOLATE;
|
||||
|
|
|
@ -67,10 +67,21 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
|
|||
this.transportShardAction = actionName + "[s]";
|
||||
this.executor = executor();
|
||||
|
||||
if (!isSubAction()) {
|
||||
transportService.registerHandler(actionName, new TransportHandler());
|
||||
}
|
||||
transportService.registerHandler(transportShardAction, new ShardTransportHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the action is a main one or a subaction. Used to decide whether we need to register
|
||||
* the main transport handler. In fact if the action is a subaction, its execute method
|
||||
* will be called locally to its parent action.
|
||||
*/
|
||||
protected boolean isSubAction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doExecute(Request request, ActionListener<Response> listener) {
|
||||
new AsyncSingleAction(request, listener).start();
|
||||
|
|
|
@ -49,6 +49,11 @@ public class TransportSingleShardMultiTermsVectorAction extends TransportShardSi
|
|||
this.indicesService = indicesService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSubAction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String executor() {
|
||||
return ThreadPool.Names.GET;
|
||||
|
|
|
@ -230,7 +230,7 @@ final class ActionNames {
|
|||
addShardAction(ExplainAction.NAME, "explain", builder);
|
||||
addShardAction(GetAction.NAME, "get", builder);
|
||||
builder.put(MultiGetAction.NAME, "mget");
|
||||
addShardAction(MultiGetAction.NAME + "[shard]", "mget/shard", builder);
|
||||
builder.put(MultiGetAction.NAME + "[shard][s]", "mget/shard/s");
|
||||
|
||||
builder.put(GetIndexedScriptAction.NAME, "getIndexedScript");
|
||||
builder.put(PutIndexedScriptAction.NAME, "putIndexedScript");
|
||||
|
@ -239,12 +239,12 @@ final class ActionNames {
|
|||
builder.put(MoreLikeThisAction.NAME, "mlt");
|
||||
|
||||
builder.put(MultiPercolateAction.NAME, "mpercolate");
|
||||
addShardAction(MultiPercolateAction.NAME + "[shard]", "mpercolate/shard", builder);
|
||||
builder.put(MultiPercolateAction.NAME + "[shard][s]", "mpercolate/shard/s");
|
||||
|
||||
builder.put(MultiSearchAction.NAME, "msearch");
|
||||
|
||||
builder.put(MultiTermVectorsAction.NAME, "mtv");
|
||||
addShardAction(MultiTermVectorsAction.NAME + "[shard]", "mtv/shard", builder);
|
||||
builder.put(MultiTermVectorsAction.NAME + "[shard][s]", "mtv/shard/s");
|
||||
|
||||
addShardAction(PercolateAction.NAME, "percolate", builder);
|
||||
|
||||
|
|
Loading…
Reference in New Issue