deprecate Supplier<Response> constructors in HandledTransportAction (#44456) (#44533)

This commit deprecates all constructors of HandledTransportAction
that take in a Supplier instead of a Writeable.Reader for response
objects.

in addition to the deprecation, the following modules were updated to
leverage Writeable

- modules:ingest-common
- modules:lang-mustache

relates #34389.
This commit is contained in:
Tal Levy 2019-07-17 22:47:09 -07:00 committed by GitHub
parent a5ad59451c
commit 38d2ada84f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 10 deletions

View File

@ -55,16 +55,17 @@ public class GrokProcessorGetAction extends ActionType<GrokProcessorGetAction.Re
}
public static class Request extends ActionRequest {
@Override
public ActionRequestValidationException validate() {
return null;
}
Request() {}
Request(StreamInput in) throws IOException {
super(in);
}
@Override
public ActionRequestValidationException validate() {
return null;
}
}
public static class Response extends ActionResponse implements ToXContentObject {

View File

@ -20,7 +20,6 @@
package org.elasticsearch.script.mustache;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.common.io.stream.Writeable;
public class MultiSearchTemplateAction extends ActionType<MultiSearchTemplateResponse> {
@ -30,9 +29,4 @@ public class MultiSearchTemplateAction extends ActionType<MultiSearchTemplateRes
private MultiSearchTemplateAction() {
super(NAME, MultiSearchTemplateResponse::new);
}
@Override
public Writeable.Reader<MultiSearchTemplateResponse> getResponseReader() {
return MultiSearchTemplateResponse::new;
}
}

View File

@ -34,6 +34,10 @@ import java.util.function.Supplier;
*/
public abstract class HandledTransportAction<Request extends ActionRequest, Response extends ActionResponse>
extends TransportAction<Request, Response> {
/**
* @deprecated Use {@link #HandledTransportAction(String, TransportService, ActionFilters, Writeable.Reader)} instead.
*/
@Deprecated
protected HandledTransportAction(String actionName, TransportService transportService,
Supplier<Request> request, ActionFilters actionFilters) {
this(actionName, true, transportService, request, actionFilters);
@ -49,6 +53,10 @@ public abstract class HandledTransportAction<Request extends ActionRequest, Resp
this(actionName, true, transportService, actionFilters, requestReader, executor);
}
/**
* @deprecated Use {@link #HandledTransportAction(String, boolean, TransportService, ActionFilters, Writeable.Reader)} instead.
*/
@Deprecated
protected HandledTransportAction(String actionName, boolean canTripCircuitBreaker,
TransportService transportService, Supplier<Request> request, ActionFilters actionFilters) {
super(actionName, actionFilters, transportService.getTaskManager());
@ -56,6 +64,10 @@ public abstract class HandledTransportAction<Request extends ActionRequest, Resp
new TransportHandler());
}
/**
* @deprecated Use {@link #HandledTransportAction(String, boolean, TransportService, ActionFilters, Writeable.Reader, String)} instead.
*/
@Deprecated
protected HandledTransportAction(String actionName, TransportService transportService, Supplier<Request> request,
ActionFilters actionFilters, String executor) {
super(actionName, actionFilters, transportService.getTaskManager());