Adjust CCR Actions after RequestBuilder is removed

CCR side of #30966
This commit is contained in:
Nhat Nguyen 2018-06-01 23:09:59 -04:00
parent a527095b8d
commit 9564b60194
7 changed files with 17 additions and 45 deletions

View File

@ -48,8 +48,7 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public class CreateAndFollowIndexAction extends Action<CreateAndFollowIndexAction.Request, CreateAndFollowIndexAction.Response, public class CreateAndFollowIndexAction extends Action<CreateAndFollowIndexAction.Request, CreateAndFollowIndexAction.Response> {
CreateAndFollowIndexAction.RequestBuilder> {
public static final CreateAndFollowIndexAction INSTANCE = new CreateAndFollowIndexAction(); public static final CreateAndFollowIndexAction INSTANCE = new CreateAndFollowIndexAction();
public static final String NAME = "cluster:admin/xpack/ccr/create_and_follow_index"; public static final String NAME = "cluster:admin/xpack/ccr/create_and_follow_index";
@ -58,11 +57,6 @@ public class CreateAndFollowIndexAction extends Action<CreateAndFollowIndexActio
super(NAME); super(NAME);
} }
@Override
public RequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RequestBuilder(client);
}
@Override @Override
public Response newResponse() { public Response newResponse() {
return new Response(); return new Response();
@ -155,7 +149,7 @@ public class CreateAndFollowIndexAction extends Action<CreateAndFollowIndexActio
} }
} }
public static class RequestBuilder extends ActionRequestBuilder<Request, Response, CreateAndFollowIndexAction.RequestBuilder> { public static class RequestBuilder extends ActionRequestBuilder<Request, Response> {
RequestBuilder(ElasticsearchClient client) { RequestBuilder(ElasticsearchClient client) {
super(client, INSTANCE, new Request()); super(client, INSTANCE, new Request());

View File

@ -40,8 +40,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class FollowIndexAction extends Action<FollowIndexAction.Request, public class FollowIndexAction extends Action<FollowIndexAction.Request, FollowIndexAction.Response> {
FollowIndexAction.Response, FollowIndexAction.RequestBuilder> {
public static final FollowIndexAction INSTANCE = new FollowIndexAction(); public static final FollowIndexAction INSTANCE = new FollowIndexAction();
public static final String NAME = "cluster:admin/xpack/ccr/follow_index"; public static final String NAME = "cluster:admin/xpack/ccr/follow_index";
@ -50,11 +49,6 @@ public class FollowIndexAction extends Action<FollowIndexAction.Request,
super(NAME); super(NAME);
} }
@Override
public RequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RequestBuilder(client, this);
}
@Override @Override
public Response newResponse() { public Response newResponse() {
return new Response(); return new Response();
@ -134,9 +128,9 @@ public class FollowIndexAction extends Action<FollowIndexAction.Request,
} }
} }
public static class RequestBuilder extends ActionRequestBuilder<Request, Response, FollowIndexAction.RequestBuilder> { public static class RequestBuilder extends ActionRequestBuilder<Request, Response> {
RequestBuilder(ElasticsearchClient client, Action<Request, Response, RequestBuilder> action) { RequestBuilder(ElasticsearchClient client, Action<Request, Response> action) {
super(client, action, new Request()); super(client, action, new Request());
} }
} }

View File

@ -39,7 +39,7 @@ import java.util.Objects;
import static org.elasticsearch.action.ValidateActions.addValidationError; import static org.elasticsearch.action.ValidateActions.addValidationError;
public class ShardChangesAction extends Action<ShardChangesAction.Request, ShardChangesAction.Response, ShardChangesAction.RequestBuilder> { public class ShardChangesAction extends Action<ShardChangesAction.Request, ShardChangesAction.Response> {
public static final ShardChangesAction INSTANCE = new ShardChangesAction(); public static final ShardChangesAction INSTANCE = new ShardChangesAction();
public static final String NAME = "indices:data/read/xpack/ccr/shard_changes"; public static final String NAME = "indices:data/read/xpack/ccr/shard_changes";
@ -48,11 +48,6 @@ public class ShardChangesAction extends Action<ShardChangesAction.Request, Shard
super(NAME); super(NAME);
} }
@Override
public RequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RequestBuilder(client, this);
}
@Override @Override
public Response newResponse() { public Response newResponse() {
return new Response(); return new Response();
@ -209,7 +204,7 @@ public class ShardChangesAction extends Action<ShardChangesAction.Request, Shard
static class RequestBuilder extends SingleShardOperationRequestBuilder<Request, Response, RequestBuilder> { static class RequestBuilder extends SingleShardOperationRequestBuilder<Request, Response, RequestBuilder> {
RequestBuilder(ElasticsearchClient client, Action<Request, Response, RequestBuilder> action) { RequestBuilder(ElasticsearchClient client, Action<Request, Response> action) {
super(client, action, new Request()); super(client, action, new Request());
} }
} }

View File

@ -427,8 +427,8 @@ public class ShardFollowTasksExecutor extends PersistentTasksExecutor<ShardFollo
protected < protected <
Request extends ActionRequest, Request extends ActionRequest,
Response extends ActionResponse, Response extends ActionResponse,
RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> RequestBuilder extends ActionRequestBuilder<Request, Response>>
void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) { void doExecute(Action<Request, Response> action, Request request, ActionListener<Response> listener) {
final Supplier<ThreadContext.StoredContext> supplier = threadContext.newRestorableContext(false); final Supplier<ThreadContext.StoredContext> supplier = threadContext.newRestorableContext(false);
try (ThreadContext.StoredContext ignore = stashWithHeaders(threadContext, filteredHeaders)) { try (ThreadContext.StoredContext ignore = stashWithHeaders(threadContext, filteredHeaders)) {
super.doExecute(action, request, new ContextPreservingActionListener<>(supplier, listener)); super.doExecute(action, request, new ContextPreservingActionListener<>(supplier, listener));

View File

@ -31,8 +31,7 @@ import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReferenceArray; import java.util.concurrent.atomic.AtomicReferenceArray;
public class UnfollowIndexAction extends Action<UnfollowIndexAction.Request, UnfollowIndexAction.Response, public class UnfollowIndexAction extends Action<UnfollowIndexAction.Request, UnfollowIndexAction.Response> {
UnfollowIndexAction.RequestBuilder> {
public static final UnfollowIndexAction INSTANCE = new UnfollowIndexAction(); public static final UnfollowIndexAction INSTANCE = new UnfollowIndexAction();
public static final String NAME = "cluster:admin/xpack/ccr/unfollow_index"; public static final String NAME = "cluster:admin/xpack/ccr/unfollow_index";
@ -41,11 +40,6 @@ public class UnfollowIndexAction extends Action<UnfollowIndexAction.Request, Unf
super(NAME); super(NAME);
} }
@Override
public RequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RequestBuilder(client);
}
@Override @Override
public Response newResponse() { public Response newResponse() {
return new Response(); return new Response();
@ -104,7 +98,7 @@ public class UnfollowIndexAction extends Action<UnfollowIndexAction.Request, Unf
} }
public static class RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder> { public static class RequestBuilder extends ActionRequestBuilder<Request, Response> {
RequestBuilder(ElasticsearchClient client) { RequestBuilder(ElasticsearchClient client) {
super(client, INSTANCE, new Request()); super(client, INSTANCE, new Request());

View File

@ -9,7 +9,7 @@ import org.elasticsearch.action.Action;
import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.client.ElasticsearchClient;
public class BulkShardOperationsAction public class BulkShardOperationsAction
extends Action<BulkShardOperationsRequest, BulkShardOperationsResponse, BulkShardOperationsRequestBuilder> { extends Action<BulkShardOperationsRequest, BulkShardOperationsResponse> {
public static final BulkShardOperationsAction INSTANCE = new BulkShardOperationsAction(); public static final BulkShardOperationsAction INSTANCE = new BulkShardOperationsAction();
public static final String NAME = "indices:data/write/bulk_shard_operations[s]"; public static final String NAME = "indices:data/write/bulk_shard_operations[s]";
@ -18,11 +18,6 @@ public class BulkShardOperationsAction
super(NAME); super(NAME);
} }
@Override
public BulkShardOperationsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new BulkShardOperationsRequestBuilder(client);
}
@Override @Override
public BulkShardOperationsResponse newResponse() { public BulkShardOperationsResponse newResponse() {
return new BulkShardOperationsResponse(); return new BulkShardOperationsResponse();

View File

@ -9,7 +9,7 @@ import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.client.ElasticsearchClient;
public class BulkShardOperationsRequestBuilder public class BulkShardOperationsRequestBuilder
extends ActionRequestBuilder<BulkShardOperationsRequest, BulkShardOperationsResponse, BulkShardOperationsRequestBuilder> { extends ActionRequestBuilder<BulkShardOperationsRequest, BulkShardOperationsResponse> {
public BulkShardOperationsRequestBuilder(final ElasticsearchClient client) { public BulkShardOperationsRequestBuilder(final ElasticsearchClient client) {
super(client, BulkShardOperationsAction.INSTANCE, new BulkShardOperationsRequest()); super(client, BulkShardOperationsAction.INSTANCE, new BulkShardOperationsRequest());