Add StreamableResponseAction to aid in deprecation of Streamable (#43770)

The Action base class currently works for both Streamable and Writeable
response types. This commit intorduces StreamableResponseAction, for
which only the legacy Action implementions which provide newResponse()
will extend. This eliminates the need for overriding newResponse() with
an UnsupportedOperationException.

relates #34389
This commit is contained in:
Ryan Ernst 2019-06-28 14:01:47 -07:00 committed by GitHub
parent 5ac7ec2513
commit e6444d3007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
277 changed files with 346 additions and 934 deletions

View file

@ -18,10 +18,10 @@
*/
package org.elasticsearch.plugin.noop.action.bulk;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.StreamableResponseAction;
import org.elasticsearch.action.bulk.BulkResponse;
public class NoopBulkAction extends Action<BulkResponse> {
public class NoopBulkAction extends StreamableResponseAction<BulkResponse> {
public static final String NAME = "mock:data/write/bulk";
public static final NoopBulkAction INSTANCE = new NoopBulkAction();

View file

@ -30,11 +30,6 @@ public class NoopSearchAction extends Action<SearchResponse> {
super(NAME);
}
@Override
public SearchResponse newResponse() {
throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable");
}
@Override
public Writeable.Reader<SearchResponse> getResponseReader() {
return SearchResponse::new;