Skip to content

Commit

Permalink
deprecate Supplier<Response> constructors in HandledTransportAction (e…
Browse files Browse the repository at this point in the history
…lastic#44456)

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 elastic#34389.
  • Loading branch information
talevy authored Jul 18, 2019
1 parent e854a19 commit c9fa03d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@ private GrokProcessorGetAction() {
}

public static class Request extends ActionRequest {
@Override
public ActionRequestValidationException validate() {
return null;
}

Request() {}
public Request() {}

Request(StreamInput in) throws IOException {
super(in);
}

@Override
public ActionRequestValidationException validate() {
return null;
}
}

public static class Response extends ActionResponse implements ToXContentObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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> {

Expand All @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public class MultiSearchTemplateRequest extends ActionRequest implements Composi

public MultiSearchTemplateRequest() {}

public MultiSearchTemplateRequest(StreamInput in) throws IOException {
MultiSearchTemplateRequest(StreamInput in) throws IOException {
super(in);
maxConcurrentSearchRequests = in.readVInt();
requests = in.readStreamableList(SearchTemplateRequest::new);
requests = in.readList(SearchTemplateRequest::new);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
*/
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);
Expand All @@ -49,13 +53,21 @@ protected HandledTransportAction(String actionName, TransportService transportSe
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());
transportService.registerRequestHandler(actionName, request, ThreadPool.Names.SAME, false, canTripCircuitBreaker,
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());
Expand Down

0 comments on commit c9fa03d

Please sign in to comment.