From f193d147642627fd94278a2940fd77c716d79fe8 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Fri, 19 Jul 2019 13:33:38 -0700 Subject: [PATCH] Convert remaining Action Response/Request to writeable.reader (#44528) (#44607) This commit converts readFrom to ctor with StreamInput on the remaining ActionResponse and ActionRequest classes. relates #34389 --- .../ingest/common/GrokProcessorGetAction.java | 5 -- .../common/GrokProcessorGetActionTests.java | 3 +- .../mustache/MultiSearchTemplateRequest.java | 5 -- .../mustache/MultiSearchTemplateResponse.java | 5 -- .../mustache/SearchTemplateRequest.java | 13 +-- .../mustache/SearchTemplateResponse.java | 5 -- .../action/PainlessContextAction.java | 10 --- .../action/PainlessExecuteAction.java | 5 -- .../index/rankeval/RankEvalRequest.java | 7 +- .../index/rankeval/RankEvalResponse.java | 5 -- .../elasticsearch/action/ActionRequest.java | 4 +- .../elasticsearch/action/ActionResponse.java | 4 +- .../action/StreamableResponseActionType.java | 51 ------------ .../ClusterAllocationExplainAction.java | 11 +-- .../ClusterAllocationExplainResponse.java | 10 +-- ...ansportClusterAllocationExplainAction.java | 14 ++-- .../AddVotingConfigExclusionsResponse.java | 5 -- .../ClearVotingConfigExclusionsResponse.java | 5 -- .../cluster/health/ClusterHealthAction.java | 11 +-- .../cluster/health/ClusterHealthResponse.java | 30 +++---- .../health/TransportClusterHealthAction.java | 16 ++-- .../node/liveness/LivenessRequest.java | 9 +++ .../node/liveness/LivenessResponse.java | 14 ++-- .../liveness/TransportLivenessAction.java | 4 +- .../node/tasks/get/GetTaskRequest.java | 11 +-- .../node/tasks/get/GetTaskResponse.java | 6 +- .../cluster/remote/RemoteInfoResponse.java | 5 -- .../get/GetRepositoriesResponse.java | 5 -- .../TransportVerifyRepositoryAction.java | 11 ++- .../verify/VerifyRepositoryAction.java | 11 +-- .../verify/VerifyRepositoryResponse.java | 12 ++- .../shards/ClusterSearchShardsResponse.java | 5 -- .../create/CreateSnapshotAction.java | 11 +-- .../create/CreateSnapshotResponse.java | 12 ++- .../create/TransportCreateSnapshotAction.java | 11 ++- .../snapshots/get/GetSnapshotsResponse.java | 5 -- .../restore/RestoreClusterStateListener.java | 2 +- .../restore/RestoreSnapshotAction.java | 11 +-- .../restore/RestoreSnapshotResponse.java | 10 +-- .../TransportRestoreSnapshotAction.java | 11 ++- .../status/SnapshotsStatusAction.java | 11 +-- .../status/SnapshotsStatusResponse.java | 20 ++--- .../TransportSnapshotsStatusAction.java | 9 ++- .../cluster/state/ClusterStateAction.java | 11 +-- .../cluster/state/ClusterStateResponse.java | 32 ++++---- .../state/TransportClusterStateAction.java | 15 ++-- .../storedscripts/GetStoredScriptAction.java | 11 +-- .../GetStoredScriptResponse.java | 28 +++---- .../TransportGetStoredScriptAction.java | 11 ++- .../tasks/PendingClusterTasksAction.java | 11 +-- .../tasks/PendingClusterTasksResponse.java | 18 ++--- .../TransportPendingClusterTasksAction.java | 16 ++-- .../alias/exists/AliasesExistAction.java | 11 +-- .../alias/exists/AliasesExistResponse.java | 10 +-- .../exists/TransportAliasesExistAction.java | 17 ++-- .../indices/alias/get/GetAliasesAction.java | 11 +-- .../indices/alias/get/GetAliasesResponse.java | 16 ++-- .../alias/get/TransportGetAliasesAction.java | 10 ++- .../admin/indices/analyze/AnalyzeAction.java | 5 -- .../exists/indices/IndicesExistsAction.java | 11 +-- .../exists/indices/IndicesExistsResponse.java | 10 +-- .../indices/TransportIndicesExistsAction.java | 11 ++- .../types/TransportTypesExistsAction.java | 11 ++- .../exists/types/TypesExistsAction.java | 11 +-- .../exists/types/TypesExistsResponse.java | 10 +-- .../indices/flush/SyncedFlushResponse.java | 5 -- .../admin/indices/get/GetIndexResponse.java | 5 -- .../mapping/get/GetFieldMappingsRequest.java | 9 +-- .../mapping/get/GetFieldMappingsResponse.java | 5 -- .../mapping/get/GetMappingsResponse.java | 5 -- .../settings/get/GetSettingsAction.java | 11 +-- .../settings/get/GetSettingsResponse.java | 40 +++++----- .../get/TransportGetSettingsAction.java | 11 ++- .../shards/IndicesShardStoresAction.java | 11 +-- .../shards/IndicesShardStoresResponse.java | 39 ++++----- .../TransportIndicesShardStoresAction.java | 10 ++- .../template/get/GetIndexTemplatesAction.java | 11 +-- .../get/GetIndexTemplatesResponse.java | 17 ++-- .../get/TransportGetIndexTemplatesAction.java | 14 ++-- .../query/ShardValidateQueryRequest.java | 5 -- .../action/bulk/BulkRequest.java | 5 -- .../action/bulk/BulkResponse.java | 5 -- .../action/explain/ExplainResponse.java | 5 -- .../FieldCapabilitiesIndexResponse.java | 18 ++--- .../fieldcaps/FieldCapabilitiesRequest.java | 5 -- .../fieldcaps/FieldCapabilitiesResponse.java | 5 -- .../elasticsearch/action/get/GetResponse.java | 5 -- .../action/get/MultiGetRequest.java | 5 -- .../action/get/MultiGetResponse.java | 5 -- .../action/get/MultiGetShardResponse.java | 5 -- .../action/ingest/GetPipelineAction.java | 11 +-- .../action/ingest/GetPipelineResponse.java | 18 ++--- .../ingest/GetPipelineTransportAction.java | 11 ++- .../action/ingest/SimulatePipelineAction.java | 11 +-- .../ingest/SimulatePipelineRequest.java | 5 -- .../ingest/SimulatePipelineResponse.java | 35 ++++---- .../elasticsearch/action/main/MainAction.java | 1 - .../action/main/MainRequest.java | 5 -- .../action/main/MainResponse.java | 5 -- .../action/search/ClearScrollRequest.java | 5 -- .../action/search/ClearScrollResponse.java | 5 -- .../action/search/MultiSearchRequest.java | 5 -- .../action/search/MultiSearchResponse.java | 5 -- .../action/search/SearchRequest.java | 5 -- .../action/search/SearchResponse.java | 5 -- .../action/search/SearchScrollRequest.java | 5 -- .../action/search/SearchTransportService.java | 8 -- .../support/HandledTransportAction.java | 21 ----- .../support/broadcast/BroadcastRequest.java | 5 -- .../support/broadcast/BroadcastResponse.java | 5 -- .../broadcast/BroadcastShardRequest.java | 5 -- .../node/TransportBroadcastByNodeAction.java | 5 -- .../support/master/AcknowledgedResponse.java | 5 -- .../support/master/MasterNodeRequest.java | 6 -- .../StreamableTransportMasterNodeAction.java | 79 ------------------- ...reamableTransportMasterNodeReadAction.java | 78 ------------------ .../master/TransportMasterNodeAction.java | 19 ----- .../master/TransportMasterNodeReadAction.java | 15 ---- .../support/nodes/BaseNodesRequest.java | 5 -- .../support/nodes/BaseNodesResponse.java | 5 -- .../replication/ReplicationRequest.java | 5 -- .../replication/ReplicationResponse.java | 5 -- .../TransportReplicationAction.java | 22 ++---- .../InstanceShardOperationRequest.java | 6 -- .../termvectors/MultiTermVectorsRequest.java | 5 -- .../termvectors/MultiTermVectorsResponse.java | 5 -- .../MultiTermVectorsShardResponse.java | 5 -- .../termvectors/TermVectorsResponse.java | 5 -- .../action/update/UpdateRequest.java | 9 +-- .../TransportClientNodesService.java | 8 +- .../reindex/AbstractBulkByScrollRequest.java | 5 -- .../AbstractBulkIndexByScrollRequest.java | 5 -- .../index/reindex/BulkByScrollResponse.java | 5 -- .../index/reindex/ReindexRequest.java | 5 -- .../index/reindex/UpdateByQueryRequest.java | 5 -- .../RecoveryTranslogOperationsRequest.java | 5 -- .../persistent/PersistentTaskResponse.java | 5 -- .../search/fetch/ShardFetchRequest.java | 5 -- .../search/fetch/ShardFetchSearchRequest.java | 4 - .../internal/InternalScrollSearchRequest.java | 5 -- .../internal/ShardSearchTransportRequest.java | 5 -- .../search/query/QuerySearchRequest.java | 5 -- .../transport/RemoteClusterConnection.java | 8 +- .../transport/TransportActionProxy.java | 5 -- .../transport/TransportHandshaker.java | 4 +- .../action/ActionModuleTests.java | 9 +-- .../org/elasticsearch/action/ActionTests.java | 9 +-- .../health/ClusterHealthResponsesTests.java | 15 ++-- .../restore/RestoreSnapshotResponseTests.java | 2 +- .../state/ClusterStateResponseTests.java | 15 ++-- .../GetStoredScriptResponseTests.java | 13 +-- .../alias/get/GetAliasesResponseTests.java | 9 ++- .../get/GetSettingsResponseTests.java | 18 ++--- .../ingest/GetPipelineResponseTests.java | 23 +++--- .../ingest/SimulatePipelineResponseTests.java | 3 +- .../TransportMasterNodeActionTests.java | 27 ++++--- ...ReplicationAllPermitsAcquisitionTests.java | 5 +- .../InternalOrPrivateSettingsPlugin.java | 25 +++--- .../transport/TransportActionProxyTests.java | 5 -- .../AbstractSimpleTransportTestCase.java | 15 +--- .../xpack/ccr/action/ShardChangesAction.java | 5 -- .../ClearCcrRestoreSessionRequest.java | 7 +- .../DeleteInternalCcrRepositoryRequest.java | 6 -- .../GetCcrRestoreFileChunkRequest.java | 5 -- .../PutCcrRestoreSessionAction.java | 5 -- .../PutInternalCcrRepositoryRequest.java | 6 -- .../license/GetBasicStatusResponse.java | 5 -- .../license/GetLicenseResponse.java | 5 -- .../license/GetTrialStatusResponse.java | 5 -- .../license/PostStartTrialResponse.java | 5 -- .../protocol/xpack/XPackInfoRequest.java | 22 +++--- .../protocol/xpack/XPackInfoResponse.java | 5 -- .../xpack/graph/GraphExploreRequest.java | 5 -- .../xpack/graph/GraphExploreResponse.java | 5 -- .../migration/IndexUpgradeInfoResponse.java | 5 -- .../xpack/watcher/DeleteWatchRequest.java | 5 -- .../xpack/watcher/DeleteWatchResponse.java | 5 -- .../xpack/watcher/PutWatchRequest.java | 5 -- .../xpack/watcher/PutWatchResponse.java | 5 -- .../action/AbstractGetResourcesRequest.java | 5 -- .../action/AbstractGetResourcesResponse.java | 5 -- .../core/action/TransportXPackInfoAction.java | 2 +- .../xpack/core/action/XPackUsageResponse.java | 4 - .../action/GetAutoFollowPatternAction.java | 2 +- .../GetDataFrameTransformsStatsAction.java | 5 -- .../deprecation/DeprecationInfoAction.java | 5 -- .../ExplainLifecycleResponse.java | 5 -- .../action/GetLifecycleAction.java | 5 -- .../action/GetStatusAction.java | 5 -- .../RemoveIndexLifecyclePolicyAction.java | 5 -- .../ml/action/DeleteExpiredDataAction.java | 5 -- .../ml/action/DeleteModelSnapshotAction.java | 5 -- .../ml/action/EvaluateDataFrameAction.java | 10 --- .../ml/action/FindFileStructureAction.java | 10 --- .../core/ml/action/GetBucketsAction.java | 7 +- .../ml/action/GetCalendarEventsAction.java | 5 -- .../core/ml/action/GetCalendarsAction.java | 5 -- .../core/ml/action/GetCategoriesAction.java | 5 -- .../core/ml/action/GetInfluencersAction.java | 5 -- .../ml/action/GetModelSnapshotsAction.java | 5 -- .../ml/action/GetOverallBucketsAction.java | 5 -- .../core/ml/action/GetRecordsAction.java | 5 -- .../xpack/core/ml/action/MlInfoAction.java | 5 -- .../ml/action/PostCalendarEventsAction.java | 10 --- .../core/ml/action/PreviewDatafeedAction.java | 10 --- .../core/ml/action/PutCalendarAction.java | 10 --- .../action/PutDataFrameAnalyticsAction.java | 5 -- .../core/ml/action/PutDatafeedAction.java | 5 -- .../xpack/core/ml/action/PutFilterAction.java | 10 --- .../xpack/core/ml/action/PutJobAction.java | 5 -- .../ml/action/RevertModelSnapshotAction.java | 5 -- .../ml/action/UpdateCalendarJobAction.java | 5 -- .../core/ml/action/UpdateFilterAction.java | 5 -- .../ml/action/UpdateModelSnapshotAction.java | 10 --- .../ml/action/ValidateDetectorAction.java | 5 -- .../ml/action/ValidateJobConfigAction.java | 5 -- .../action/MonitoringBulkRequest.java | 5 -- .../action/MonitoringBulkResponse.java | 5 -- .../rollup/action/GetRollupCapsAction.java | 5 -- .../action/GetRollupIndexCapsAction.java | 5 -- .../security/action/CreateApiKeyRequest.java | 5 -- .../security/action/CreateApiKeyResponse.java | 5 -- .../security/action/GetApiKeyRequest.java | 4 - .../security/action/GetApiKeyResponse.java | 5 -- .../action/InvalidateApiKeyRequest.java | 5 -- .../action/InvalidateApiKeyResponse.java | 5 -- .../OpenIdConnectAuthenticateRequest.java | 7 +- .../OpenIdConnectAuthenticateResponse.java | 7 +- .../oidc/OpenIdConnectLogoutRequest.java | 7 +- .../oidc/OpenIdConnectLogoutResponse.java | 7 +- ...IdConnectPrepareAuthenticationRequest.java | 7 +- ...dConnectPrepareAuthenticationResponse.java | 7 +- .../privilege/DeletePrivilegesRequest.java | 5 -- .../privilege/DeletePrivilegesResponse.java | 5 -- .../GetBuiltinPrivilegesResponse.java | 5 -- .../privilege/GetPrivilegesRequest.java | 5 -- .../privilege/GetPrivilegesResponse.java | 5 -- .../privilege/PutPrivilegesRequest.java | 5 -- .../privilege/PutPrivilegesResponse.java | 4 - .../action/role/DeleteRoleRequest.java | 5 -- .../action/role/DeleteRoleResponse.java | 5 -- .../security/action/role/GetRolesRequest.java | 5 -- .../action/role/GetRolesResponse.java | 5 -- .../security/action/role/PutRoleRequest.java | 5 -- .../security/action/role/PutRoleResponse.java | 4 - .../rolemapping/DeleteRoleMappingRequest.java | 9 +-- .../DeleteRoleMappingResponse.java | 5 -- .../rolemapping/GetRoleMappingsRequest.java | 9 +-- .../rolemapping/GetRoleMappingsResponse.java | 5 -- .../rolemapping/PutRoleMappingRequest.java | 5 -- .../rolemapping/PutRoleMappingResponse.java | 4 - .../action/saml/SamlAuthenticateResponse.java | 4 - .../saml/SamlInvalidateSessionResponse.java | 6 -- .../action/saml/SamlLogoutResponse.java | 5 -- .../SamlPrepareAuthenticationRequest.java | 9 +-- .../SamlPrepareAuthenticationResponse.java | 5 -- .../action/token/CreateTokenRequest.java | 5 -- .../action/token/CreateTokenResponse.java | 5 -- .../action/token/InvalidateTokenRequest.java | 5 -- .../action/token/InvalidateTokenResponse.java | 5 -- .../action/user/AuthenticateRequest.java | 5 -- .../action/user/AuthenticateResponse.java | 5 -- .../action/user/ChangePasswordRequest.java | 5 -- .../action/user/DeleteUserRequest.java | 5 -- .../action/user/DeleteUserResponse.java | 5 -- .../action/user/GetUserPrivilegesRequest.java | 10 --- .../user/GetUserPrivilegesResponse.java | 4 - .../security/action/user/GetUsersRequest.java | 5 -- .../action/user/GetUsersResponse.java | 5 -- .../action/user/HasPrivilegesRequest.java | 5 -- .../action/user/HasPrivilegesResponse.java | 4 - .../security/action/user/PutUserRequest.java | 5 -- .../security/action/user/PutUserResponse.java | 5 -- .../action/user/SetEnabledRequest.java | 5 -- .../ssl/action/GetCertificateInfoAction.java | 10 ++- .../TransportGetCertificateInfoAction.java | 3 +- .../actions/ack/AckWatchRequest.java | 5 -- .../actions/ack/AckWatchResponse.java | 5 -- .../activate/ActivateWatchRequest.java | 5 -- .../activate/ActivateWatchResponse.java | 5 -- .../actions/execute/ExecuteWatchRequest.java | 5 -- .../actions/execute/ExecuteWatchResponse.java | 5 -- .../actions/get/GetWatchRequest.java | 5 -- .../actions/get/GetWatchResponse.java | 5 -- ...FrameTransformsCheckpointServiceTests.java | 3 +- .../xpack/sql/action/AbstractSqlRequest.java | 5 -- .../sql/action/SqlClearCursorResponse.java | 5 -- .../xpack/sql/action/SqlQueryResponse.java | 5 -- .../sql/action/SqlTranslateResponse.java | 5 -- 289 files changed, 504 insertions(+), 1946 deletions(-) delete mode 100644 server/src/main/java/org/elasticsearch/action/StreamableResponseActionType.java delete mode 100644 server/src/main/java/org/elasticsearch/action/support/master/StreamableTransportMasterNodeAction.java delete mode 100644 server/src/main/java/org/elasticsearch/action/support/master/StreamableTransportMasterNodeReadAction.java diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java index 39a3c9d5e73..f1f0d7c8f96 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/GrokProcessorGetAction.java @@ -93,11 +93,6 @@ public class GrokProcessorGetAction extends ActionType contentAsMap = parser.map(); diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java index 20af3f29a86..9fe7c92bb4d 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/action/PainlessContextAction.java @@ -101,11 +101,6 @@ public class PainlessContextAction extends ActionType extends ActionType { - - protected StreamableResponseActionType(String name) { - super(name, null); - } - - /** - * Creates a new response instance. - * @deprecated Implement {@link #getResponseReader()} instead and make this method throw an - * {@link UnsupportedOperationException} - */ - @Deprecated - public abstract Response newResponse(); - - @Override - public final Writeable.Reader getResponseReader() { - return in -> { - Response response = newResponse(); - response.readFrom(in); - return response; - }; - } -} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainAction.java index acaaed9eaa9..47d8a94dd2f 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainAction.java @@ -19,22 +19,17 @@ package org.elasticsearch.action.admin.cluster.allocation; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; /** * ActionType for explaining shard allocation for a shard in the cluster */ -public class ClusterAllocationExplainAction extends StreamableResponseActionType { +public class ClusterAllocationExplainAction extends ActionType { public static final ClusterAllocationExplainAction INSTANCE = new ClusterAllocationExplainAction(); public static final String NAME = "cluster:monitor/allocation/explain"; private ClusterAllocationExplainAction() { - super(NAME); - } - - @Override - public ClusterAllocationExplainResponse newResponse() { - return new ClusterAllocationExplainResponse(); + super(NAME, ClusterAllocationExplainResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainResponse.java index 344c448a2c0..0dadd794665 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainResponse.java @@ -32,7 +32,9 @@ public class ClusterAllocationExplainResponse extends ActionResponse { private ClusterAllocationExplanation cae; - public ClusterAllocationExplainResponse() { + public ClusterAllocationExplainResponse(StreamInput in) throws IOException { + super(in); + this.cae = new ClusterAllocationExplanation(in); } public ClusterAllocationExplainResponse(ClusterAllocationExplanation cae) { @@ -46,12 +48,6 @@ public class ClusterAllocationExplainResponse extends ActionResponse { return this.cae; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - this.cae = new ClusterAllocationExplanation(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { cae.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/TransportClusterAllocationExplainAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/TransportClusterAllocationExplainAction.java index a3bdc4a4c8e..ff5a8418e3c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/TransportClusterAllocationExplainAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/allocation/TransportClusterAllocationExplainAction.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.cluster.allocation; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeAction; +import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterInfo; import org.elasticsearch.cluster.ClusterInfoService; import org.elasticsearch.cluster.ClusterState; @@ -40,10 +40,12 @@ import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.gateway.GatewayAllocator; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; import java.util.List; /** @@ -51,7 +53,7 @@ import java.util.List; * master node in the cluster. */ public class TransportClusterAllocationExplainAction - extends StreamableTransportMasterNodeAction { + extends TransportMasterNodeAction { private final ClusterInfoService clusterInfoService; private final AllocationDeciders allocationDeciders; @@ -78,13 +80,13 @@ public class TransportClusterAllocationExplainAction } @Override - protected ClusterBlockException checkBlock(ClusterAllocationExplainRequest request, ClusterState state) { - return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ); + protected ClusterAllocationExplainResponse read(StreamInput in) throws IOException { + return new ClusterAllocationExplainResponse(in); } @Override - protected ClusterAllocationExplainResponse newResponse() { - return new ClusterAllocationExplainResponse(); + protected ClusterBlockException checkBlock(ClusterAllocationExplainRequest request, ClusterState state) { + return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsResponse.java index a3f23871b65..b6530be9092 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/AddVotingConfigExclusionsResponse.java @@ -39,11 +39,6 @@ public class AddVotingConfigExclusionsResponse extends ActionResponse implements super(in); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException {} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/ClearVotingConfigExclusionsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/ClearVotingConfigExclusionsResponse.java index d44c00c7ee1..1c36c992edd 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/ClearVotingConfigExclusionsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/configuration/ClearVotingConfigExclusionsResponse.java @@ -38,11 +38,6 @@ public class ClearVotingConfigExclusionsResponse extends ActionResponse implemen super(in); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException {} diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthAction.java index e8f5ecfaf5b..7af8da7b95c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.cluster.health; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class ClusterHealthAction extends StreamableResponseActionType { +public class ClusterHealthAction extends ActionType { public static final ClusterHealthAction INSTANCE = new ClusterHealthAction(); public static final String NAME = "cluster:monitor/health"; private ClusterHealthAction() { - super(NAME); - } - - @Override - public ClusterHealthResponse newResponse() { - return new ClusterHealthResponse(); + super(NAME, ClusterHealthResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java index 54bd5f1b1c3..163c66003f4 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponse.java @@ -142,7 +142,18 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo private ClusterStateHealth clusterStateHealth; private ClusterHealthStatus clusterHealthStatus; - ClusterHealthResponse() { + public ClusterHealthResponse() {} + + public ClusterHealthResponse(StreamInput in) throws IOException { + super(in); + clusterName = in.readString(); + clusterHealthStatus = ClusterHealthStatus.fromValue(in.readByte()); + clusterStateHealth = new ClusterStateHealth(in); + numberOfPendingTasks = in.readInt(); + timedOut = in.readBoolean(); + numberOfInFlightFetch = in.readInt(); + delayedUnassignedShards= in.readInt(); + taskMaxWaitingTime = in.readTimeValue(); } /** needed for plugins BWC */ @@ -277,22 +288,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo } public static ClusterHealthResponse readResponseFrom(StreamInput in) throws IOException { - ClusterHealthResponse response = new ClusterHealthResponse(); - response.readFrom(in); - return response; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - clusterName = in.readString(); - clusterHealthStatus = ClusterHealthStatus.fromValue(in.readByte()); - clusterStateHealth = new ClusterStateHealth(in); - numberOfPendingTasks = in.readInt(); - timedOut = in.readBoolean(); - numberOfInFlightFetch = in.readInt(); - delayedUnassignedShards= in.readInt(); - taskMaxWaitingTime = in.readTimeValue(); + return new ClusterHealthResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java index 06edbad8327..29575bb99c0 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java @@ -26,7 +26,7 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.ClusterStateUpdateTask; @@ -39,6 +39,7 @@ import org.elasticsearch.cluster.routing.UnassignedInfo; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.gateway.GatewayAllocator; import org.elasticsearch.index.IndexNotFoundException; @@ -46,10 +47,11 @@ import org.elasticsearch.tasks.Task; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; import java.util.function.Consumer; import java.util.function.Predicate; -public class TransportClusterHealthAction extends StreamableTransportMasterNodeReadAction { +public class TransportClusterHealthAction extends TransportMasterNodeReadAction { private static final Logger logger = LogManager.getLogger(TransportClusterHealthAction.class); @@ -71,14 +73,14 @@ public class TransportClusterHealthAction extends StreamableTransportMasterNodeR } @Override - protected ClusterBlockException checkBlock(ClusterHealthRequest request, ClusterState state) { - // we want users to be able to call this even when there are global blocks, just to check the health (are there blocks?) - return null; + protected ClusterHealthResponse read(StreamInput in) throws IOException { + return new ClusterHealthResponse(in); } @Override - protected ClusterHealthResponse newResponse() { - return new ClusterHealthResponse(); + protected ClusterBlockException checkBlock(ClusterHealthRequest request, ClusterState state) { + // we want users to be able to call this even when there are global blocks, just to check the health (are there blocks?) + return null; } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessRequest.java index d6441bb8e77..78fa77cdd2b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessRequest.java @@ -20,12 +20,21 @@ package org.elasticsearch.action.admin.cluster.node.liveness; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; +import org.elasticsearch.common.io.stream.StreamInput; + +import java.io.IOException; /** * Transport level private response for the transport handler registered under * {@value org.elasticsearch.action.admin.cluster.node.liveness.TransportLivenessAction#NAME} */ public final class LivenessRequest extends ActionRequest { + public LivenessRequest() {} + + public LivenessRequest(StreamInput in) throws IOException { + super(in); + } + @Override public ActionRequestValidationException validate() { return null; diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessResponse.java index 7cb8664af98..591b5d112c4 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/LivenessResponse.java @@ -36,7 +36,12 @@ public final class LivenessResponse extends ActionResponse { private DiscoveryNode node; private ClusterName clusterName; - public LivenessResponse() { + public LivenessResponse() {} + + public LivenessResponse(StreamInput in) throws IOException { + super(in); + clusterName = new ClusterName(in); + node = in.readOptionalWriteable(DiscoveryNode::new); } public LivenessResponse(ClusterName clusterName, DiscoveryNode node) { @@ -44,13 +49,6 @@ public final class LivenessResponse extends ActionResponse { this.clusterName = clusterName; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - clusterName = new ClusterName(in); - node = in.readOptionalWriteable(DiscoveryNode::new); - } - @Override public void writeTo(StreamOutput out) throws IOException { clusterName.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java index ef8014cade4..c79e94342d3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/liveness/TransportLivenessAction.java @@ -35,8 +35,8 @@ public final class TransportLivenessAction implements TransportRequestHandler
  • { + TransportMasterNodeAction { private final RepositoriesService repositoriesService; @@ -57,8 +60,8 @@ public class TransportVerifyRepositoryAction extends } @Override - protected VerifyRepositoryResponse newResponse() { - return new VerifyRepositoryResponse(); + protected VerifyRepositoryResponse read(StreamInput in) throws IOException { + return new VerifyRepositoryResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryAction.java index 9601ceecf0d..21a573e8580 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryAction.java @@ -19,23 +19,18 @@ package org.elasticsearch.action.admin.cluster.repositories.verify; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; /** * Unregister repository action */ -public class VerifyRepositoryAction extends StreamableResponseActionType { +public class VerifyRepositoryAction extends ActionType { public static final VerifyRepositoryAction INSTANCE = new VerifyRepositoryAction(); public static final String NAME = "cluster:admin/repository/verify"; private VerifyRepositoryAction() { - super(NAME); - } - - @Override - public VerifyRepositoryResponse newResponse() { - return new VerifyRepositoryResponse(); + super(NAME, VerifyRepositoryResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java index 3853b6d2cd8..dd04ef89310 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/verify/VerifyRepositoryResponse.java @@ -115,7 +115,11 @@ public class VerifyRepositoryResponse extends ActionResponse implements ToXConte PARSER.declareNamedObjects(VerifyRepositoryResponse::setNodes, NodeView.PARSER, new ParseField("nodes")); } - VerifyRepositoryResponse() { + public VerifyRepositoryResponse() {} + + public VerifyRepositoryResponse(StreamInput in) throws IOException { + super(in); + this.nodes = in.readList(NodeView::new); } public VerifyRepositoryResponse(DiscoveryNode[] nodes) { @@ -126,12 +130,6 @@ public class VerifyRepositoryResponse extends ActionResponse implements ToXConte this.nodes = nodes; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - this.nodes = in.readList(NodeView::new); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeList(nodes); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java index ce997906478..4209a36c934 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsResponse.java @@ -57,11 +57,6 @@ public class ClusterSearchShardsResponse extends ActionResponse implements ToXCo } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(groups.length); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotAction.java index a7a8e5467c7..0ca295b12e2 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotAction.java @@ -19,23 +19,18 @@ package org.elasticsearch.action.admin.cluster.snapshots.create; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; /** * Create snapshot action */ -public class CreateSnapshotAction extends StreamableResponseActionType { +public class CreateSnapshotAction extends ActionType { public static final CreateSnapshotAction INSTANCE = new CreateSnapshotAction(); public static final String NAME = "cluster:admin/snapshot/create"; private CreateSnapshotAction() { - super(NAME); - } - - @Override - public CreateSnapshotResponse newResponse() { - return new CreateSnapshotResponse(); + super(NAME, CreateSnapshotResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java index 97dfe91b03a..a63f2cf8104 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/CreateSnapshotResponse.java @@ -51,11 +51,15 @@ public class CreateSnapshotResponse extends ActionResponse implements ToXContent @Nullable private SnapshotInfo snapshotInfo; + CreateSnapshotResponse() {} + CreateSnapshotResponse(@Nullable SnapshotInfo snapshotInfo) { this.snapshotInfo = snapshotInfo; } - CreateSnapshotResponse() { + public CreateSnapshotResponse(StreamInput in) throws IOException { + super(in); + snapshotInfo = in.readOptionalWriteable(SnapshotInfo::new); } private void setSnapshotInfoFromBuilder(SnapshotInfoBuilder snapshotInfoBuilder) { @@ -71,12 +75,6 @@ public class CreateSnapshotResponse extends ActionResponse implements ToXContent return snapshotInfo; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - snapshotInfo = in.readOptionalWriteable(SnapshotInfo::new); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeOptionalWriteable(snapshotInfo); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java index 835d7d8bc8b..830ec07c890 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/create/TransportCreateSnapshotAction.java @@ -21,21 +21,24 @@ package org.elasticsearch.action.admin.cluster.snapshots.create; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeAction; +import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.snapshots.SnapshotsService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; + /** * Transport action for create snapshot operation */ -public class TransportCreateSnapshotAction extends StreamableTransportMasterNodeAction { +public class TransportCreateSnapshotAction extends TransportMasterNodeAction { private final SnapshotsService snapshotsService; @Inject @@ -55,8 +58,8 @@ public class TransportCreateSnapshotAction extends StreamableTransportMasterNode } @Override - protected CreateSnapshotResponse newResponse() { - return new CreateSnapshotResponse(); + protected CreateSnapshotResponse read(StreamInput in) throws IOException { + return new CreateSnapshotResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java index 4740d0e1839..6c249b2b4cd 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/GetSnapshotsResponse.java @@ -80,11 +80,6 @@ public class GetSnapshotsResponse extends ActionResponse implements ToXContentOb return snapshots; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(snapshots.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreClusterStateListener.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreClusterStateListener.java index a74aad3ddb5..3439bbc47ec 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreClusterStateListener.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreClusterStateListener.java @@ -58,7 +58,7 @@ public class RestoreClusterStateListener implements ClusterStateListener { // on the current master and as such it might miss some intermediary cluster states due to batching. // Clean up listener in that case and acknowledge completion of restore operation to client. clusterService.removeListener(this); - listener.onResponse(new RestoreSnapshotResponse(null)); + listener.onResponse(new RestoreSnapshotResponse((RestoreInfo) null)); } else if (newEntry == null) { clusterService.removeListener(this); ImmutableOpenMap shards = prevEntry.shards(); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotAction.java index 7f473d10a28..7073a5a9638 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotAction.java @@ -19,23 +19,18 @@ package org.elasticsearch.action.admin.cluster.snapshots.restore; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; /** * Restore snapshot action */ -public class RestoreSnapshotAction extends StreamableResponseActionType { +public class RestoreSnapshotAction extends ActionType { public static final RestoreSnapshotAction INSTANCE = new RestoreSnapshotAction(); public static final String NAME = "cluster:admin/snapshot/restore"; private RestoreSnapshotAction() { - super(NAME); - } - - @Override - public RestoreSnapshotResponse newResponse() { - return new RestoreSnapshotResponse(); + super(NAME, RestoreSnapshotResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java index 1049102d414..a956057c63b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponse.java @@ -49,7 +49,9 @@ public class RestoreSnapshotResponse extends ActionResponse implements ToXConten this.restoreInfo = restoreInfo; } - RestoreSnapshotResponse() { + public RestoreSnapshotResponse(StreamInput in) throws IOException { + super(in); + restoreInfo = RestoreInfo.readOptionalRestoreInfo(in); } /** @@ -61,12 +63,6 @@ public class RestoreSnapshotResponse extends ActionResponse implements ToXConten return restoreInfo; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - restoreInfo = RestoreInfo.readOptionalRestoreInfo(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeOptionalWriteable(restoreInfo); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java index ec2f9773602..934e7c35927 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/restore/TransportRestoreSnapshotAction.java @@ -21,21 +21,24 @@ package org.elasticsearch.action.admin.cluster.snapshots.restore; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeAction; +import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.snapshots.RestoreService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; + /** * Transport action for restore snapshot operation */ -public class TransportRestoreSnapshotAction extends StreamableTransportMasterNodeAction { +public class TransportRestoreSnapshotAction extends TransportMasterNodeAction { private final RestoreService restoreService; @Inject @@ -55,8 +58,8 @@ public class TransportRestoreSnapshotAction extends StreamableTransportMasterNod } @Override - protected RestoreSnapshotResponse newResponse() { - return new RestoreSnapshotResponse(); + protected RestoreSnapshotResponse read(StreamInput in) throws IOException { + return new RestoreSnapshotResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusAction.java index ec95e0e14f1..b0833c777b7 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusAction.java @@ -19,23 +19,18 @@ package org.elasticsearch.action.admin.cluster.snapshots.status; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; /** * Snapshots status action */ -public class SnapshotsStatusAction extends StreamableResponseActionType { +public class SnapshotsStatusAction extends ActionType { public static final SnapshotsStatusAction INSTANCE = new SnapshotsStatusAction(); public static final String NAME = "cluster:admin/snapshot/status"; private SnapshotsStatusAction() { - super(NAME); - } - - @Override - public SnapshotsStatusResponse newResponse() { - return new SnapshotsStatusResponse(); + super(NAME, SnapshotsStatusResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java index 20a37823f2b..7d6912204ab 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/SnapshotsStatusResponse.java @@ -42,7 +42,14 @@ public class SnapshotsStatusResponse extends ActionResponse implements ToXConten private List snapshots = Collections.emptyList(); - SnapshotsStatusResponse() { + public SnapshotsStatusResponse(StreamInput in) throws IOException { + super(in); + int size = in.readVInt(); + List builder = new ArrayList<>(); + for (int i = 0; i < size; i++) { + builder.add(SnapshotStatus.readSnapshotStatus(in)); + } + snapshots = Collections.unmodifiableList(builder); } SnapshotsStatusResponse(List snapshots) { @@ -58,17 +65,6 @@ public class SnapshotsStatusResponse extends ActionResponse implements ToXConten return snapshots; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - int size = in.readVInt(); - List builder = new ArrayList<>(); - for (int i = 0; i < size; i++) { - builder.add(SnapshotStatus.readSnapshotStatus(in)); - } - snapshots = Collections.unmodifiableList(builder); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(snapshots.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java index 918111d4a5f..cf5dfe80cef 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java @@ -23,7 +23,7 @@ import com.carrotsearch.hppc.cursors.ObjectCursor; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeAction; +import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.SnapshotsInProgress; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -32,6 +32,7 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.snapshots.IndexShardSnapshotStatus; @@ -56,7 +57,7 @@ import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; -public class TransportSnapshotsStatusAction extends StreamableTransportMasterNodeAction { +public class TransportSnapshotsStatusAction extends TransportMasterNodeAction { private final SnapshotsService snapshotsService; @@ -84,8 +85,8 @@ public class TransportSnapshotsStatusAction extends StreamableTransportMasterNod } @Override - protected SnapshotsStatusResponse newResponse() { - return new SnapshotsStatusResponse(); + protected SnapshotsStatusResponse read(StreamInput in) throws IOException { + return new SnapshotsStatusResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateAction.java index b8a08444efc..918219f1b1b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.cluster.state; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class ClusterStateAction extends StreamableResponseActionType { +public class ClusterStateAction extends ActionType { public static final ClusterStateAction INSTANCE = new ClusterStateAction(); public static final String NAME = "cluster:monitor/state"; private ClusterStateAction() { - super(NAME); - } - - @Override - public ClusterStateResponse newResponse() { - return new ClusterStateResponse(); + super(NAME, ClusterStateResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java index dadcc1e91a6..680c2339543 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/ClusterStateResponse.java @@ -41,7 +41,20 @@ public class ClusterStateResponse extends ActionResponse { private ClusterState clusterState; private boolean waitForTimedOut = false; - public ClusterStateResponse() { + public ClusterStateResponse(StreamInput in) throws IOException { + super(in); + clusterName = new ClusterName(in); + if (in.getVersion().onOrAfter(Version.V_6_6_0)) { + clusterState = in.readOptionalWriteable(innerIn -> ClusterState.readFrom(innerIn, null)); + } else { + clusterState = ClusterState.readFrom(in, null); + } + if (in.getVersion().before(Version.V_7_0_0)) { + new ByteSizeValue(in); + } + if (in.getVersion().onOrAfter(Version.V_6_6_0)) { + waitForTimedOut = in.readBoolean(); + } } public ClusterStateResponse(ClusterName clusterName, ClusterState clusterState, boolean waitForTimedOut) { @@ -73,23 +86,6 @@ public class ClusterStateResponse extends ActionResponse { return waitForTimedOut; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - clusterName = new ClusterName(in); - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - clusterState = in.readOptionalWriteable(innerIn -> ClusterState.readFrom(innerIn, null)); - } else { - clusterState = ClusterState.readFrom(in, null); - } - if (in.getVersion().before(Version.V_7_0_0)) { - new ByteSizeValue(in); - } - if (in.getVersion().onOrAfter(Version.V_6_6_0)) { - waitForTimedOut = in.readBoolean(); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { clusterName.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java index 291066c5389..b5931d4b4e1 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/state/TransportClusterStateAction.java @@ -24,7 +24,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateObserver; import org.elasticsearch.cluster.NotMasterException; @@ -36,6 +36,7 @@ import org.elasticsearch.cluster.metadata.MetaData.Custom; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.node.NodeClosedException; import org.elasticsearch.threadpool.ThreadPool; @@ -44,7 +45,7 @@ import org.elasticsearch.transport.TransportService; import java.io.IOException; import java.util.function.Predicate; -public class TransportClusterStateAction extends StreamableTransportMasterNodeReadAction { +public class TransportClusterStateAction extends TransportMasterNodeReadAction { private final Logger logger = LogManager.getLogger(getClass()); @@ -69,6 +70,11 @@ public class TransportClusterStateAction extends StreamableTransportMasterNodeRe return ThreadPool.Names.SAME; } + @Override + protected ClusterStateResponse read(StreamInput in) throws IOException { + return new ClusterStateResponse(in); + } + @Override protected ClusterBlockException checkBlock(ClusterStateRequest request, ClusterState state) { // cluster state calls are done also on a fully blocked cluster to figure out what is going @@ -78,11 +84,6 @@ public class TransportClusterStateAction extends StreamableTransportMasterNodeRe return null; } - @Override - protected ClusterStateResponse newResponse() { - return new ClusterStateResponse(); - } - @Override protected void masterOperation(final ClusterStateRequest request, final ClusterState state, final ActionListener listener) throws IOException { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptAction.java index ed74c5b928e..206c8b4a91f 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.cluster.storedscripts; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class GetStoredScriptAction extends StreamableResponseActionType { +public class GetStoredScriptAction extends ActionType { public static final GetStoredScriptAction INSTANCE = new GetStoredScriptAction(); public static final String NAME = "cluster:admin/script/get"; private GetStoredScriptAction() { - super(NAME); - } - - @Override - public GetStoredScriptResponse newResponse() { - return new GetStoredScriptResponse(); + super(NAME, GetStoredScriptResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponse.java index 6819e552f1a..9ccedd2811c 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponse.java @@ -66,7 +66,18 @@ public class GetStoredScriptResponse extends ActionResponse implements StatusToX private String id; private StoredScriptSource source; - GetStoredScriptResponse() { + public GetStoredScriptResponse(StreamInput in) throws IOException { + super(in); + + if (in.readBoolean()) { + source = new StoredScriptSource(in); + } else { + source = null; + } + + if (in.getVersion().onOrAfter(Version.V_6_4_0)) { + id = in.readString(); + } } GetStoredScriptResponse(String id, StoredScriptSource source) { @@ -109,21 +120,6 @@ public class GetStoredScriptResponse extends ActionResponse implements StatusToX return PARSER.parse(parser, null); } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - - if (in.readBoolean()) { - source = new StoredScriptSource(in); - } else { - source = null; - } - - if (in.getVersion().onOrAfter(Version.V_6_4_0)) { - id = in.readString(); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { if (source == null) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportGetStoredScriptAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportGetStoredScriptAction.java index b4fc6331808..6a976d409b7 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportGetStoredScriptAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/TransportGetStoredScriptAction.java @@ -21,18 +21,21 @@ package org.elasticsearch.action.admin.cluster.storedscripts; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.script.ScriptService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class TransportGetStoredScriptAction extends StreamableTransportMasterNodeReadAction { private final ScriptService scriptService; @@ -52,8 +55,8 @@ public class TransportGetStoredScriptAction extends StreamableTransportMasterNod } @Override - protected GetStoredScriptResponse newResponse() { - return new GetStoredScriptResponse(); + protected GetStoredScriptResponse read(StreamInput in) throws IOException { + return new GetStoredScriptResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksAction.java index 240575bb1da..3414002ea2b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.cluster.tasks; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class PendingClusterTasksAction extends StreamableResponseActionType { +public class PendingClusterTasksAction extends ActionType { public static final PendingClusterTasksAction INSTANCE = new PendingClusterTasksAction(); public static final String NAME = "cluster:monitor/task"; private PendingClusterTasksAction() { - super(NAME); - } - - @Override - public PendingClusterTasksResponse newResponse() { - return new PendingClusterTasksResponse(); + super(NAME, PendingClusterTasksResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java index 60698a74ab5..fa323c152d6 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/PendingClusterTasksResponse.java @@ -35,7 +35,13 @@ public class PendingClusterTasksResponse extends ActionResponse implements Itera private List pendingTasks; - PendingClusterTasksResponse() { + public PendingClusterTasksResponse(StreamInput in) throws IOException { + super(in); + int size = in.readVInt(); + pendingTasks = new ArrayList<>(size); + for (int i = 0; i < size; i++) { + pendingTasks.add(new PendingClusterTask(in)); + } } PendingClusterTasksResponse(List pendingTasks) { @@ -100,16 +106,6 @@ public class PendingClusterTasksResponse extends ActionResponse implements Itera } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - int size = in.readVInt(); - pendingTasks = new ArrayList<>(size); - for (int i = 0; i < size; i++) { - pendingTasks.add(new PendingClusterTask(in)); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(pendingTasks.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java index 0486acf6829..b065bd8304e 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/tasks/TransportPendingClusterTasksAction.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.cluster.tasks; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; @@ -29,13 +29,15 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.PendingClusterTask; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; import java.util.List; public class TransportPendingClusterTasksAction - extends StreamableTransportMasterNodeReadAction { + extends TransportMasterNodeReadAction { private final ClusterService clusterService; @@ -44,7 +46,7 @@ public class TransportPendingClusterTasksAction ThreadPool threadPool, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) { super(PendingClusterTasksAction.NAME, transportService, clusterService, threadPool, actionFilters, - PendingClusterTasksRequest::new, indexNameExpressionResolver); + PendingClusterTasksRequest::new, indexNameExpressionResolver); this.clusterService = clusterService; } @@ -55,13 +57,13 @@ public class TransportPendingClusterTasksAction } @Override - protected ClusterBlockException checkBlock(PendingClusterTasksRequest request, ClusterState state) { - return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ); + protected PendingClusterTasksResponse read(StreamInput in) throws IOException { + return new PendingClusterTasksResponse(in); } @Override - protected PendingClusterTasksResponse newResponse() { - return new PendingClusterTasksResponse(); + protected ClusterBlockException checkBlock(PendingClusterTasksRequest request, ClusterState state) { + return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistAction.java index 190dd43dac7..a55fdaed5b2 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.indices.alias.exists; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class AliasesExistAction extends StreamableResponseActionType { +public class AliasesExistAction extends ActionType { public static final AliasesExistAction INSTANCE = new AliasesExistAction(); public static final String NAME = "indices:admin/aliases/exists"; private AliasesExistAction() { - super(NAME); - } - - @Override - public AliasesExistResponse newResponse() { - return new AliasesExistResponse(); + super(NAME, AliasesExistResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistResponse.java index ccf74a5a4da..a9cfffdc277 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/AliasesExistResponse.java @@ -33,7 +33,9 @@ public class AliasesExistResponse extends ActionResponse { this.exists = exists; } - AliasesExistResponse() { + AliasesExistResponse(StreamInput in) throws IOException { + super(in); + exists = in.readBoolean(); } public boolean exists() { @@ -44,12 +46,6 @@ public class AliasesExistResponse extends ActionResponse { return exists(); } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - exists = in.readBoolean(); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(exists); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java index 25ff0dfc75b..c1afa4ccf86 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/exists/TransportAliasesExistAction.java @@ -21,17 +21,20 @@ package org.elasticsearch.action.admin.indices.alias.exists; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class TransportAliasesExistAction extends StreamableTransportMasterNodeReadAction { +import java.io.IOException; + +public class TransportAliasesExistAction extends TransportMasterNodeReadAction { @Inject public TransportAliasesExistAction(TransportService transportService, ClusterService clusterService, @@ -48,14 +51,14 @@ public class TransportAliasesExistAction extends StreamableTransportMasterNodeRe } @Override - protected ClusterBlockException checkBlock(GetAliasesRequest request, ClusterState state) { - return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_READ, - indexNameExpressionResolver.concreteIndexNames(state, request)); + protected AliasesExistResponse read(StreamInput in) throws IOException { + return new AliasesExistResponse(in); } @Override - protected AliasesExistResponse newResponse() { - return new AliasesExistResponse(); + protected ClusterBlockException checkBlock(GetAliasesRequest request, ClusterState state) { + return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_READ, + indexNameExpressionResolver.concreteIndexNames(state, request)); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesAction.java index 2798f21e820..cd0b1352fc3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.indices.alias.get; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class GetAliasesAction extends StreamableResponseActionType { +public class GetAliasesAction extends ActionType { public static final GetAliasesAction INSTANCE = new GetAliasesAction(); public static final String NAME = "indices:admin/aliases/get"; private GetAliasesAction() { - super(NAME); - } - - @Override - public GetAliasesResponse newResponse() { - return new GetAliasesResponse(); + super(NAME, GetAliasesResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java index c84eb7f0b99..3376d9c8100 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponse.java @@ -40,16 +40,8 @@ public class GetAliasesResponse extends ActionResponse { this.aliases = aliases; } - GetAliasesResponse() { - } - - public ImmutableOpenMap> getAliases() { - return aliases; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); + public GetAliasesResponse(StreamInput in) throws IOException { + super(in); int size = in.readVInt(); ImmutableOpenMap.Builder> aliasesBuilder = ImmutableOpenMap.builder(); for (int i = 0; i < size; i++) { @@ -64,6 +56,10 @@ public class GetAliasesResponse extends ActionResponse { aliases = aliasesBuilder.build(); } + public ImmutableOpenMap> getAliases() { + return aliases; + } + @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(aliases.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java index 0cd8546e9e2..e45e7c2930a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/get/TransportGetAliasesAction.java @@ -20,7 +20,7 @@ package org.elasticsearch.action.admin.indices.alias.get; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; @@ -29,13 +29,15 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; import java.util.Collections; import java.util.List; -public class TransportGetAliasesAction extends StreamableTransportMasterNodeReadAction { +public class TransportGetAliasesAction extends TransportMasterNodeReadAction { @Inject public TransportGetAliasesAction(TransportService transportService, ClusterService clusterService, @@ -58,8 +60,8 @@ public class TransportGetAliasesAction extends StreamableTransportMasterNodeRead } @Override - protected GetAliasesResponse newResponse() { - return new GetAliasesResponse(); + protected GetAliasesResponse read(StreamInput in) throws IOException { + return new GetAliasesResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeAction.java index 9af3690eb77..51ac4bee892 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/analyze/AnalyzeAction.java @@ -313,11 +313,6 @@ public class AnalyzeAction extends ActionType { detail = in.readOptionalWriteable(DetailAnalyzeResponse::new); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - public List getTokens() { return this.tokens; } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsAction.java index 7ba2cfdabf5..e9314f86563 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.indices.exists.indices; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class IndicesExistsAction extends StreamableResponseActionType { +public class IndicesExistsAction extends ActionType { public static final IndicesExistsAction INSTANCE = new IndicesExistsAction(); public static final String NAME = "indices:admin/exists"; private IndicesExistsAction() { - super(NAME); - } - - @Override - public IndicesExistsResponse newResponse() { - return new IndicesExistsResponse(); + super(NAME, IndicesExistsResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsResponse.java index 5c84ccefa31..adff900a0b0 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/IndicesExistsResponse.java @@ -29,7 +29,9 @@ public class IndicesExistsResponse extends ActionResponse { private boolean exists; - IndicesExistsResponse() { + IndicesExistsResponse(StreamInput in) throws IOException { + super(in); + exists = in.readBoolean(); } public IndicesExistsResponse(boolean exists) { @@ -40,12 +42,6 @@ public class IndicesExistsResponse extends ActionResponse { return this.exists; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - exists = in.readBoolean(); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(exists); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java index 3de4fde3336..17143c2cd75 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/indices/TransportIndicesExistsAction.java @@ -22,21 +22,24 @@ package org.elasticsearch.action.admin.indices.exists.indices; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; + /** * Indices exists action. */ -public class TransportIndicesExistsAction extends StreamableTransportMasterNodeReadAction { +public class TransportIndicesExistsAction extends TransportMasterNodeReadAction { @Inject public TransportIndicesExistsAction(TransportService transportService, ClusterService clusterService, @@ -53,8 +56,8 @@ public class TransportIndicesExistsAction extends StreamableTransportMasterNodeR } @Override - protected IndicesExistsResponse newResponse() { - return new IndicesExistsResponse(); + protected IndicesExistsResponse read(StreamInput in) throws IOException { + return new IndicesExistsResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java index 5fde258a25f..d7a264940b1 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TransportTypesExistsAction.java @@ -20,7 +20,7 @@ package org.elasticsearch.action.admin.indices.exists.types; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; @@ -28,13 +28,16 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.MappingMetaData; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; + /** * Types exists transport action. */ -public class TransportTypesExistsAction extends StreamableTransportMasterNodeReadAction { +public class TransportTypesExistsAction extends TransportMasterNodeReadAction { @Inject public TransportTypesExistsAction(TransportService transportService, ClusterService clusterService, @@ -51,8 +54,8 @@ public class TransportTypesExistsAction extends StreamableTransportMasterNodeRea } @Override - protected TypesExistsResponse newResponse() { - return new TypesExistsResponse(); + protected TypesExistsResponse read(StreamInput in) throws IOException { + return new TypesExistsResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsAction.java index 3b62c5d4e4f..f74db89deb5 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsAction.java @@ -18,19 +18,14 @@ */ package org.elasticsearch.action.admin.indices.exists.types; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class TypesExistsAction extends StreamableResponseActionType { +public class TypesExistsAction extends ActionType { public static final TypesExistsAction INSTANCE = new TypesExistsAction(); public static final String NAME = "indices:admin/types/exists"; private TypesExistsAction() { - super(NAME); - } - - @Override - public TypesExistsResponse newResponse() { - return new TypesExistsResponse(); + super(NAME, TypesExistsResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsResponse.java index d7d4180b3a3..c8ba1e44eb2 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/exists/types/TypesExistsResponse.java @@ -31,7 +31,9 @@ public class TypesExistsResponse extends ActionResponse { private boolean exists; - TypesExistsResponse() { + TypesExistsResponse(StreamInput in) throws IOException { + super(in); + exists = in.readBoolean(); } public TypesExistsResponse(boolean exists) { @@ -42,12 +44,6 @@ public class TypesExistsResponse extends ActionResponse { return this.exists; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - exists = in.readBoolean(); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(exists); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java index 77bedae5319..00cd1bd769e 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/flush/SyncedFlushResponse.java @@ -198,11 +198,6 @@ public class SyncedFlushResponse extends ActionResponse implements ToXContentFra static final String REASON = "reason"; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { shardCounts.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java index ce8cbb03bc9..1a3fd0b9cfe 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexResponse.java @@ -198,11 +198,6 @@ public class GetIndexResponse extends ActionResponse implements ToXContentObject } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeStringArray(indices); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsRequest.java index 2fb1d97951b..7442fe2dd35 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsRequest.java @@ -48,9 +48,7 @@ public class GetFieldMappingsRequest extends ActionRequest implements IndicesReq private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen(); - public GetFieldMappingsRequest() { - - } + public GetFieldMappingsRequest() {} public GetFieldMappingsRequest(StreamInput in) throws IOException { super(in); @@ -140,9 +138,4 @@ public class GetFieldMappingsRequest extends ActionRequest implements IndicesReq out.writeStringArray(fields); out.writeBoolean(includeDefaults); } - - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java index eda801c04c5..28ff148c5e2 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetFieldMappingsResponse.java @@ -286,11 +286,6 @@ public class GetFieldMappingsResponse extends ActionResponse implements ToXConte } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(mappings.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java index 52adbd7ab32..67bc8726852 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/get/GetMappingsResponse.java @@ -71,11 +71,6 @@ public class GetMappingsResponse extends ActionResponse implements ToXContentFra return mappings(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(mappings.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsAction.java index 6e17be72417..ffbc6e67775 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.admin.indices.settings.get; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class GetSettingsAction extends StreamableResponseActionType { +public class GetSettingsAction extends ActionType { public static final GetSettingsAction INSTANCE = new GetSettingsAction(); public static final String NAME = "indices:monitor/settings/get"; public GetSettingsAction() { - super(NAME); - } - - @Override - public GetSettingsResponse newResponse() { - return new GetSettingsResponse(); + super(NAME, GetSettingsResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java index 214883faf7e..42b1b695b84 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponse.java @@ -50,7 +50,24 @@ public class GetSettingsResponse extends ActionResponse implements ToXContentObj this.indexToDefaultSettings = indexToDefaultSettings; } - GetSettingsResponse() { + public GetSettingsResponse(StreamInput in) throws IOException { + super(in); + + int settingsSize = in.readVInt(); + ImmutableOpenMap.Builder settingsBuilder = ImmutableOpenMap.builder(); + for (int i = 0; i < settingsSize; i++) { + settingsBuilder.put(in.readString(), Settings.readSettingsFromStream(in)); + } + ImmutableOpenMap.Builder defaultSettingsBuilder = ImmutableOpenMap.builder(); + + if (in.getVersion().onOrAfter(org.elasticsearch.Version.V_6_4_0)) { + int defaultSettingsSize = in.readVInt(); + for (int i = 0; i < defaultSettingsSize ; i++) { + defaultSettingsBuilder.put(in.readString(), Settings.readSettingsFromStream(in)); + } + } + indexToSettings = settingsBuilder.build(); + indexToDefaultSettings = defaultSettingsBuilder.build(); } /** @@ -99,27 +116,6 @@ public class GetSettingsResponse extends ActionResponse implements ToXContentObj } } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - - int settingsSize = in.readVInt(); - ImmutableOpenMap.Builder settingsBuilder = ImmutableOpenMap.builder(); - for (int i = 0; i < settingsSize; i++) { - settingsBuilder.put(in.readString(), Settings.readSettingsFromStream(in)); - } - ImmutableOpenMap.Builder defaultSettingsBuilder = ImmutableOpenMap.builder(); - - if (in.getVersion().onOrAfter(org.elasticsearch.Version.V_6_4_0)) { - int defaultSettingsSize = in.readVInt(); - for (int i = 0; i < defaultSettingsSize ; i++) { - defaultSettingsBuilder.put(in.readString(), Settings.readSettingsFromStream(in)); - } - } - indexToSettings = settingsBuilder.build(); - indexToDefaultSettings = defaultSettingsBuilder.build(); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(indexToSettings.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java index 6e1d6e84bc3..d2f730c0dfb 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/settings/get/TransportGetSettingsAction.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.indices.settings.get; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; @@ -30,6 +30,7 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.settings.IndexScopedSettings; import org.elasticsearch.common.settings.Settings; @@ -39,8 +40,10 @@ import org.elasticsearch.index.Index; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; -public class TransportGetSettingsAction extends StreamableTransportMasterNodeReadAction { + +public class TransportGetSettingsAction extends TransportMasterNodeReadAction { private final SettingsFilter settingsFilter; private final IndexScopedSettings indexScopedSettings; @@ -70,8 +73,8 @@ public class TransportGetSettingsAction extends StreamableTransportMasterNodeRea @Override - protected GetSettingsResponse newResponse() { - return new GetSettingsResponse(); + protected GetSettingsResponse read(StreamInput in) throws IOException { + return new GetSettingsResponse(in); } private static boolean isFilteredRequest(GetSettingsRequest request) { diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresAction.java index b06145bff09..70ec32ed80a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresAction.java @@ -19,7 +19,7 @@ package org.elasticsearch.action.admin.indices.shards; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; /** * ActionType for {@link TransportIndicesShardStoresAction} @@ -28,17 +28,12 @@ import org.elasticsearch.action.StreamableResponseActionType; * Shard store information reports which nodes hold shard copies, how recent they are * and any exceptions on opening the shard index or from previous engine failures */ -public class IndicesShardStoresAction extends StreamableResponseActionType { +public class IndicesShardStoresAction extends ActionType { public static final IndicesShardStoresAction INSTANCE = new IndicesShardStoresAction(); public static final String NAME = "indices:monitor/shard_stores"; private IndicesShardStoresAction() { - super(NAME); - } - - @Override - public IndicesShardStoresResponse newResponse() { - return new IndicesShardStoresResponse(); + super(NAME, IndicesShardStoresResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java index faf506fc961..ba50e26f222 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/IndicesShardStoresResponse.java @@ -291,28 +291,7 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon } public IndicesShardStoresResponse(StreamInput in) throws IOException { - readFrom(in); - } - - /** - * Returns {@link StoreStatus}s - * grouped by their index names and shard ids. - */ - public ImmutableOpenMap>> getStoreStatuses() { - return storeStatuses; - } - - /** - * Returns node {@link Failure}s encountered - * while executing the request - */ - public List getFailures() { - return failures; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); + super(in); int numResponse = in.readVInt(); ImmutableOpenMap.Builder>> storeStatusesBuilder = ImmutableOpenMap.builder(); for (int i = 0; i < numResponse; i++) { @@ -339,6 +318,22 @@ public class IndicesShardStoresResponse extends ActionResponse implements ToXCon failures = Collections.unmodifiableList(failureBuilder); } + /** + * Returns {@link StoreStatus}s + * grouped by their index names and shard ids. + */ + public ImmutableOpenMap>> getStoreStatuses() { + return storeStatuses; + } + + /** + * Returns node {@link Failure}s encountered + * while executing the request + */ + public List getFailures() { + return failures; + } + @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(storeStatuses.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/TransportIndicesShardStoresAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/TransportIndicesShardStoresAction.java index 1e4f3276cc1..17af5797e16 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shards/TransportIndicesShardStoresAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shards/TransportIndicesShardStoresAction.java @@ -23,7 +23,7 @@ import org.apache.lucene.util.CollectionUtil; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.FailedNodeException; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; @@ -41,6 +41,7 @@ import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.collect.ImmutableOpenIntMap; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.util.concurrent.CountDown; import org.elasticsearch.gateway.AsyncShardFetch; import org.elasticsearch.gateway.TransportNodesListGatewayStartedShards; @@ -49,6 +50,7 @@ import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -62,7 +64,7 @@ import java.util.concurrent.ConcurrentLinkedQueue; * indices and fetches store information from all the nodes using {@link TransportNodesListGatewayStartedShards} */ public class TransportIndicesShardStoresAction - extends StreamableTransportMasterNodeReadAction { + extends TransportMasterNodeReadAction { private final TransportNodesListGatewayStartedShards listShardStoresInfo; @@ -82,8 +84,8 @@ public class TransportIndicesShardStoresAction } @Override - protected IndicesShardStoresResponse newResponse() { - return new IndicesShardStoresResponse(); + protected IndicesShardStoresResponse read(StreamInput in) throws IOException { + return new IndicesShardStoresResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesAction.java index 743c8e4f1a9..3927b045dba 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesAction.java @@ -18,19 +18,14 @@ */ package org.elasticsearch.action.admin.indices.template.get; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class GetIndexTemplatesAction extends StreamableResponseActionType { +public class GetIndexTemplatesAction extends ActionType { public static final GetIndexTemplatesAction INSTANCE = new GetIndexTemplatesAction(); public static final String NAME = "indices:admin/template/get"; protected GetIndexTemplatesAction() { - super(NAME); - } - - @Override - public GetIndexTemplatesResponse newResponse() { - return new GetIndexTemplatesResponse(); + super(NAME, GetIndexTemplatesResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java index fd776cafcff..502f073c0a3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java @@ -39,8 +39,13 @@ public class GetIndexTemplatesResponse extends ActionResponse implements ToXCont private final List indexTemplates; - GetIndexTemplatesResponse() { + public GetIndexTemplatesResponse(StreamInput in) throws IOException { + super(in); + int size = in.readVInt(); indexTemplates = new ArrayList<>(); + for (int i = 0 ; i < size ; i++) { + indexTemplates.add(0, IndexTemplateMetaData.readFrom(in)); + } } public GetIndexTemplatesResponse(List indexTemplates) { @@ -51,16 +56,6 @@ public class GetIndexTemplatesResponse extends ActionResponse implements ToXCont return indexTemplates; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - int size = in.readVInt(); - indexTemplates.clear(); - for (int i = 0 ; i < size ; i++) { - indexTemplates.add(0, IndexTemplateMetaData.readFrom(in)); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(indexTemplates.size()); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java index d51cb105963..4ad7738986d 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/template/get/TransportGetIndexTemplatesAction.java @@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.indices.template.get; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; @@ -29,16 +29,18 @@ import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.regex.Regex; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class TransportGetIndexTemplatesAction extends - StreamableTransportMasterNodeReadAction { + TransportMasterNodeReadAction { @Inject public TransportGetIndexTemplatesAction(TransportService transportService, ClusterService clusterService, @@ -54,13 +56,13 @@ public class TransportGetIndexTemplatesAction extends } @Override - protected ClusterBlockException checkBlock(GetIndexTemplatesRequest request, ClusterState state) { - return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ); + protected GetIndexTemplatesResponse read(StreamInput in) throws IOException { + return new GetIndexTemplatesResponse(in); } @Override - protected GetIndexTemplatesResponse newResponse() { - return new GetIndexTemplatesResponse(); + protected ClusterBlockException checkBlock(GetIndexTemplatesRequest request, ClusterState state) { + return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_READ); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java index 40768bb45d3..050bb7b5d8b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/validate/query/ShardValidateQueryRequest.java @@ -93,11 +93,6 @@ public class ShardValidateQueryRequest extends BroadcastShardRequest { return this.nowInMillis; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java b/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java index 078cee647ca..c1a4014b94b 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java @@ -399,11 +399,6 @@ public class BulkRequest extends ActionRequest implements CompositeIndicesReques return validationException; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java b/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java index fef4a35f5a8..c021825bc7a 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java @@ -138,11 +138,6 @@ public class BulkResponse extends ActionResponse implements Iterable readField(StreamInput in) throws IOException { return in.readMap(StreamInput::readString, FieldCapabilities::new); } diff --git a/server/src/main/java/org/elasticsearch/action/get/GetResponse.java b/server/src/main/java/org/elasticsearch/action/get/GetResponse.java index b7f16eeba4f..a491885c93d 100644 --- a/server/src/main/java/org/elasticsearch/action/get/GetResponse.java +++ b/server/src/main/java/org/elasticsearch/action/get/GetResponse.java @@ -203,11 +203,6 @@ public class GetResponse extends ActionResponse implements Iterable { +public class GetPipelineAction extends ActionType { public static final GetPipelineAction INSTANCE = new GetPipelineAction(); public static final String NAME = "cluster:admin/ingest/pipeline/get"; public GetPipelineAction() { - super(NAME); - } - - @Override - public GetPipelineResponse newResponse() { - return new GetPipelineResponse(); + super(NAME, GetPipelineResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineResponse.java b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineResponse.java index 23641162fe3..509e120c0ac 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineResponse.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineResponse.java @@ -44,7 +44,13 @@ public class GetPipelineResponse extends ActionResponse implements StatusToXCont private List pipelines; - public GetPipelineResponse() { + public GetPipelineResponse(StreamInput in) throws IOException { + super(in); + int size = in.readVInt(); + pipelines = new ArrayList<>(size); + for (int i = 0; i < size; i++) { + pipelines.add(PipelineConfiguration.readFrom(in)); + } } public GetPipelineResponse(List pipelines) { @@ -60,16 +66,6 @@ public class GetPipelineResponse extends ActionResponse implements StatusToXCont return Collections.unmodifiableList(pipelines); } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - int size = in.readVInt(); - pipelines = new ArrayList<>(size); - for (int i = 0; i < size; i++) { - pipelines.add(PipelineConfiguration.readFrom(in)); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(pipelines.size()); diff --git a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java index 3bac2066be2..757adca0ad7 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/GetPipelineTransportAction.java @@ -21,18 +21,21 @@ package org.elasticsearch.action.ingest; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeReadAction; +import org.elasticsearch.action.support.master.TransportMasterNodeReadAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.block.ClusterBlockException; import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; +import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.ingest.IngestService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -public class GetPipelineTransportAction extends StreamableTransportMasterNodeReadAction { +import java.io.IOException; + +public class GetPipelineTransportAction extends TransportMasterNodeReadAction { @Inject public GetPipelineTransportAction(ThreadPool threadPool, ClusterService clusterService, @@ -48,8 +51,8 @@ public class GetPipelineTransportAction extends StreamableTransportMasterNodeRea } @Override - protected GetPipelineResponse newResponse() { - return new GetPipelineResponse(); + protected GetPipelineResponse read(StreamInput in) throws IOException { + return new GetPipelineResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineAction.java b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineAction.java index befa729282e..3e76c96834c 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineAction.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineAction.java @@ -19,19 +19,14 @@ package org.elasticsearch.action.ingest; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; -public class SimulatePipelineAction extends StreamableResponseActionType { +public class SimulatePipelineAction extends ActionType { public static final SimulatePipelineAction INSTANCE = new SimulatePipelineAction(); public static final String NAME = "cluster:admin/ingest/pipeline/simulate"; public SimulatePipelineAction() { - super(NAME); - } - - @Override - public SimulatePipelineResponse newResponse() { - return new SimulatePipelineResponse(); + super(NAME, SimulatePipelineResponse::new); } } diff --git a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java index eb15b56db31..de0b0c18a91 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineRequest.java @@ -102,11 +102,6 @@ public class SimulatePipelineRequest extends ActionRequest implements ToXContent return xContentType; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java index c1efaf6c54b..8597605879d 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/SimulatePipelineResponse.java @@ -103,8 +103,21 @@ public class SimulatePipelineResponse extends ActionResponse implements ToXConte new ParseField(Fields.DOCUMENTS)); } - public SimulatePipelineResponse() { - + public SimulatePipelineResponse(StreamInput in) throws IOException { + super(in); + this.pipelineId = in.readOptionalString(); + boolean verbose = in.readBoolean(); + int responsesLength = in.readVInt(); + results = new ArrayList<>(); + for (int i = 0; i < responsesLength; i++) { + SimulateDocumentResult simulateDocumentResult; + if (verbose) { + simulateDocumentResult = new SimulateDocumentVerboseResult(in); + } else { + simulateDocumentResult = new SimulateDocumentBaseResult(in); + } + results.add(simulateDocumentResult); + } } public SimulatePipelineResponse(String pipelineId, boolean verbose, List responses) { @@ -135,24 +148,6 @@ public class SimulatePipelineResponse extends ActionResponse implements ToXConte } } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - this.pipelineId = in.readOptionalString(); - boolean verbose = in.readBoolean(); - int responsesLength = in.readVInt(); - results = new ArrayList<>(); - for (int i = 0; i < responsesLength; i++) { - SimulateDocumentResult simulateDocumentResult; - if (verbose) { - simulateDocumentResult = new SimulateDocumentVerboseResult(in); - } else { - simulateDocumentResult = new SimulateDocumentBaseResult(in); - } - results.add(simulateDocumentResult); - } - } - @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); diff --git a/server/src/main/java/org/elasticsearch/action/main/MainAction.java b/server/src/main/java/org/elasticsearch/action/main/MainAction.java index 986c58556ab..e8633c018fb 100644 --- a/server/src/main/java/org/elasticsearch/action/main/MainAction.java +++ b/server/src/main/java/org/elasticsearch/action/main/MainAction.java @@ -29,5 +29,4 @@ public class MainAction extends ActionType { public MainAction() { super(NAME, MainResponse::new); } - } diff --git a/server/src/main/java/org/elasticsearch/action/main/MainRequest.java b/server/src/main/java/org/elasticsearch/action/main/MainRequest.java index 976b845d34b..ac8026fb21f 100644 --- a/server/src/main/java/org/elasticsearch/action/main/MainRequest.java +++ b/server/src/main/java/org/elasticsearch/action/main/MainRequest.java @@ -37,9 +37,4 @@ public class MainRequest extends ActionRequest { public ActionRequestValidationException validate() { return null; } - - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } } diff --git a/server/src/main/java/org/elasticsearch/action/main/MainResponse.java b/server/src/main/java/org/elasticsearch/action/main/MainResponse.java index 6982f824023..38c532525a5 100644 --- a/server/src/main/java/org/elasticsearch/action/main/MainResponse.java +++ b/server/src/main/java/org/elasticsearch/action/main/MainResponse.java @@ -97,11 +97,6 @@ public class MainResponse extends ActionResponse implements ToXContentObject { } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); diff --git a/server/src/main/java/org/elasticsearch/action/search/ClearScrollRequest.java b/server/src/main/java/org/elasticsearch/action/search/ClearScrollRequest.java index dfd05412917..c287429983e 100644 --- a/server/src/main/java/org/elasticsearch/action/search/ClearScrollRequest.java +++ b/server/src/main/java/org/elasticsearch/action/search/ClearScrollRequest.java @@ -77,11 +77,6 @@ public class ClearScrollRequest extends ActionRequest implements ToXContentObjec return validationException; } - @Override - public void readFrom(StreamInput in) { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java b/server/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java index 7e937a20640..32ab3bf045f 100644 --- a/server/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java +++ b/server/src/main/java/org/elasticsearch/action/search/ClearScrollResponse.java @@ -98,11 +98,6 @@ public class ClearScrollResponse extends ActionResponse implements StatusToXCont return PARSER.apply(parser, null); } - @Override - public void readFrom(StreamInput in) { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(succeeded); diff --git a/server/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java b/server/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java index 1478b75d632..ebe7b6126f0 100644 --- a/server/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java +++ b/server/src/main/java/org/elasticsearch/action/search/MultiSearchRequest.java @@ -143,11 +143,6 @@ public class MultiSearchRequest extends ActionRequest implements CompositeIndice } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java b/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java index 6e1d8aca622..971dede5b7f 100644 --- a/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java +++ b/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java @@ -158,11 +158,6 @@ public class MultiSearchResponse extends ActionResponse implements Iterable headers) { return new SearchTask(id, type, action, getDescription(), parentTaskId, headers); diff --git a/server/src/main/java/org/elasticsearch/action/search/SearchTransportService.java b/server/src/main/java/org/elasticsearch/action/search/SearchTransportService.java index 04e198915b3..8ea188e8b17 100644 --- a/server/src/main/java/org/elasticsearch/action/search/SearchTransportService.java +++ b/server/src/main/java/org/elasticsearch/action/search/SearchTransportService.java @@ -220,11 +220,7 @@ public class SearchTransportService { return this.id; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } - } static class SearchFreeContextRequest extends ScrollFreeContextRequest implements IndicesRequest { private OriginalIndices originalIndices; @@ -264,11 +260,7 @@ public class SearchTransportService { return originalIndices.indicesOptions(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } - } public static class SearchFreeContextResponse extends TransportResponse { diff --git a/server/src/main/java/org/elasticsearch/action/support/HandledTransportAction.java b/server/src/main/java/org/elasticsearch/action/support/HandledTransportAction.java index bf1bbe98366..4ac545ff41e 100644 --- a/server/src/main/java/org/elasticsearch/action/support/HandledTransportAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/HandledTransportAction.java @@ -27,21 +27,11 @@ import org.elasticsearch.transport.TransportChannel; import org.elasticsearch.transport.TransportRequestHandler; import org.elasticsearch.transport.TransportService; -import java.util.function.Supplier; - /** * A TransportAction that self registers a handler into the transport service */ public abstract class HandledTransportAction extends TransportAction { - /** - * @deprecated Use {@link #HandledTransportAction(String, TransportService, ActionFilters, Writeable.Reader)} instead. - */ - @Deprecated - protected HandledTransportAction(String actionName, TransportService transportService, - Supplier request, ActionFilters actionFilters) { - this(actionName, true, transportService, request, actionFilters); - } protected HandledTransportAction(String actionName, TransportService transportService, ActionFilters actionFilters, Writeable.Reader requestReader) { @@ -53,17 +43,6 @@ public abstract class HandledTransportAction request, ActionFilters actionFilters) { - super(actionName, actionFilters, transportService.getTaskManager()); - transportService.registerRequestHandler(actionName, request, ThreadPool.Names.SAME, false, canTripCircuitBreaker, - new TransportHandler()); - } - protected HandledTransportAction(String actionName, boolean canTripCircuitBreaker, TransportService transportService, ActionFilters actionFilters, Writeable.Reader requestReader) { diff --git a/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastRequest.java b/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastRequest.java index 4da9c7ff5c5..e39301b4a6f 100644 --- a/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastRequest.java +++ b/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastRequest.java @@ -82,9 +82,4 @@ public class BroadcastRequest> extends out.writeStringArrayNullable(indices); indicesOptions.writeIndicesOptions(out); } - - @Override - public final void readFrom(StreamInput in) { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } } diff --git a/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastResponse.java b/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastResponse.java index 92ac04d333c..9f5474c916d 100644 --- a/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastResponse.java +++ b/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastResponse.java @@ -132,11 +132,6 @@ public class BroadcastResponse extends ActionResponse implements ToXContentObjec return shardFailures; } - @Override - public final void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(totalShards); diff --git a/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardRequest.java b/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardRequest.java index 18c8b2e7eb2..072a262ee49 100644 --- a/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardRequest.java +++ b/server/src/main/java/org/elasticsearch/action/support/broadcast/BroadcastShardRequest.java @@ -67,11 +67,6 @@ public abstract class BroadcastShardRequest extends TransportRequest implements return originalIndices.indicesOptions(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/support/broadcast/node/TransportBroadcastByNodeAction.java b/server/src/main/java/org/elasticsearch/action/support/broadcast/node/TransportBroadcastByNodeAction.java index 8652838e312..0afd08786f7 100644 --- a/server/src/main/java/org/elasticsearch/action/support/broadcast/node/TransportBroadcastByNodeAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/broadcast/node/TransportBroadcastByNodeAction.java @@ -541,11 +541,6 @@ public abstract class TransportBroadcastByNodeAction, Response extends ActionResponse> - extends TransportMasterNodeAction { - - protected StreamableTransportMasterNodeAction(String actionName, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, Supplier request) { - super(actionName, transportService, clusterService, threadPool, - actionFilters, indexNameExpressionResolver, request); - } - - protected StreamableTransportMasterNodeAction(String actionName, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - Writeable.Reader request, IndexNameExpressionResolver indexNameExpressionResolver) { - super(actionName, transportService, clusterService, threadPool, actionFilters, request, indexNameExpressionResolver); - } - - protected StreamableTransportMasterNodeAction(String actionName, boolean canTripCircuitBreaker, - TransportService transportService, ClusterService clusterService, ThreadPool threadPool, - ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, - Supplier request) { - super(actionName, canTripCircuitBreaker, transportService, clusterService, threadPool, - actionFilters, indexNameExpressionResolver, request); - } - - protected StreamableTransportMasterNodeAction(String actionName, boolean canTripCircuitBreaker, - TransportService transportService, ClusterService clusterService, ThreadPool threadPool, - ActionFilters actionFilters, Writeable.Reader request, - IndexNameExpressionResolver indexNameExpressionResolver) { - super(actionName, canTripCircuitBreaker, transportService, clusterService, threadPool, - actionFilters, request, indexNameExpressionResolver); - } - - /** - * @return a new response instance. Typically this is used for serialization using the - * {@link org.elasticsearch.common.io.stream.Streamable#readFrom(StreamInput)} method. - */ - protected abstract Response newResponse(); - - @Override - protected final Response read(StreamInput in) throws IOException { - Response response = newResponse(); - response.readFrom(in); - return response; - } -} diff --git a/server/src/main/java/org/elasticsearch/action/support/master/StreamableTransportMasterNodeReadAction.java b/server/src/main/java/org/elasticsearch/action/support/master/StreamableTransportMasterNodeReadAction.java deleted file mode 100644 index 37cccf10dd4..00000000000 --- a/server/src/main/java/org/elasticsearch/action/support/master/StreamableTransportMasterNodeReadAction.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.elasticsearch.action.support.master; - -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; - -import java.io.IOException; -import java.util.function.Supplier; - -@Deprecated -public abstract class StreamableTransportMasterNodeReadAction, - Response extends ActionResponse> extends TransportMasterNodeReadAction { - - protected StreamableTransportMasterNodeReadAction(String actionName, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, Supplier request) { - super(actionName, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, request); - } - - protected StreamableTransportMasterNodeReadAction(String actionName, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - Writeable.Reader request, - IndexNameExpressionResolver indexNameExpressionResolver) { - super(actionName, transportService, clusterService, threadPool, actionFilters, request, indexNameExpressionResolver); - } - - protected StreamableTransportMasterNodeReadAction(String actionName, boolean checkSizeLimit, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, Supplier request) { - super(actionName, checkSizeLimit, transportService, clusterService, threadPool, - actionFilters, indexNameExpressionResolver, request); - } - - protected StreamableTransportMasterNodeReadAction(String actionName, boolean checkSizeLimit, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - Writeable.Reader request, - IndexNameExpressionResolver indexNameExpressionResolver) { - super(actionName, checkSizeLimit, transportService, clusterService, threadPool, - actionFilters, request, indexNameExpressionResolver); - } - - /** - * @return a new response instance. Typically this is used for serialization using the - * {@link org.elasticsearch.common.io.stream.Streamable#readFrom(StreamInput)} method. - */ - protected abstract Response newResponse(); - - @Override - protected final Response read(StreamInput in) throws IOException { - Response response = newResponse(); - response.readFrom(in); - return response; - } -} diff --git a/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java b/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java index 4c6f045aa50..61d4ca22dd2 100644 --- a/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeAction.java @@ -49,7 +49,6 @@ import org.elasticsearch.transport.TransportService; import java.io.IOException; import java.util.function.Predicate; -import java.util.function.Supplier; /** * A base class for operations that needs to be performed on the master node. @@ -64,30 +63,12 @@ public abstract class TransportMasterNodeAction request) { - this(actionName, true, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, request); - } - protected TransportMasterNodeAction(String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, Writeable.Reader request, IndexNameExpressionResolver indexNameExpressionResolver) { this(actionName, true, transportService, clusterService, threadPool, actionFilters, request, indexNameExpressionResolver); } - protected TransportMasterNodeAction(String actionName, boolean canTripCircuitBreaker, - TransportService transportService, ClusterService clusterService, ThreadPool threadPool, - ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver, - Supplier request) { - super(actionName, canTripCircuitBreaker, transportService, request, actionFilters); - this.transportService = transportService; - this.clusterService = clusterService; - this.threadPool = threadPool; - this.indexNameExpressionResolver = indexNameExpressionResolver; - this.executor = executor(); - } - protected TransportMasterNodeAction(String actionName, boolean canTripCircuitBreaker, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, Writeable.Reader request, diff --git a/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadAction.java b/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadAction.java index 93c7729a9d2..194439019c9 100644 --- a/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadAction.java +++ b/server/src/main/java/org/elasticsearch/action/support/master/TransportMasterNodeReadAction.java @@ -27,8 +27,6 @@ import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; -import java.util.function.Supplier; - /** * A base class for read operations that needs to be performed on the master node. * Can also be executed on the local node if needed. @@ -36,25 +34,12 @@ import java.util.function.Supplier; public abstract class TransportMasterNodeReadAction, Response extends ActionResponse> extends TransportMasterNodeAction { - protected TransportMasterNodeReadAction(String actionName, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, Supplier request) { - this(actionName, true, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver,request); - } - protected TransportMasterNodeReadAction(String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, Writeable.Reader request, IndexNameExpressionResolver indexNameExpressionResolver) { this(actionName, true, transportService, clusterService, threadPool, actionFilters, request, indexNameExpressionResolver); } - protected TransportMasterNodeReadAction(String actionName, boolean checkSizeLimit, TransportService transportService, - ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, Supplier request) { - super(actionName, checkSizeLimit, transportService, clusterService, threadPool, actionFilters, - indexNameExpressionResolver,request); - } - protected TransportMasterNodeReadAction(String actionName, boolean checkSizeLimit, TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ActionFilters actionFilters, Writeable.Reader request, IndexNameExpressionResolver indexNameExpressionResolver) { diff --git a/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java b/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java index 5c317748ac2..0da214032af 100644 --- a/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java +++ b/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesRequest.java @@ -105,11 +105,6 @@ public abstract class BaseNodesRequest return null; } - @Override - public final void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesResponse.java b/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesResponse.java index a07fc8baf4d..312c0607c4d 100644 --- a/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesResponse.java +++ b/server/src/main/java/org/elasticsearch/action/support/nodes/BaseNodesResponse.java @@ -104,11 +104,6 @@ public abstract class BaseNodesResponse return nodesMap; } - @Override - public final void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { clusterName.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java b/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java index 85890444b63..8a7f4df17be 100644 --- a/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java +++ b/server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java @@ -187,11 +187,6 @@ public abstract class ReplicationRequest(onCompletionListener, in -> new ReplicaResponse())); + new ActionListenerResponseHandler<>(onCompletionListener, ReplicaResponse::new)); } @Override @@ -958,8 +958,10 @@ public abstract class TransportReplicationAction< private long localCheckpoint; private long globalCheckpoint; - ReplicaResponse() { - + ReplicaResponse(StreamInput in) throws IOException { + super(in); + localCheckpoint = in.readZLong(); + globalCheckpoint = in.readZLong(); } public ReplicaResponse(long localCheckpoint, long globalCheckpoint) { @@ -973,13 +975,6 @@ public abstract class TransportReplicationAction< this.globalCheckpoint = globalCheckpoint; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - localCheckpoint = in.readZLong(); - globalCheckpoint = in.readZLong(); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeZLong(localCheckpoint); @@ -1035,11 +1030,8 @@ public abstract class TransportReplicationAction< } final ConcreteReplicaRequest replicaRequest = new ConcreteReplicaRequest<>( request, replica.allocationId().getId(), primaryTerm, globalCheckpoint, maxSeqNoOfUpdatesOrDeletes); - final ActionListenerResponseHandler handler = new ActionListenerResponseHandler<>(listener, in -> { - ReplicaResponse replicaResponse = new ReplicaResponse(); - replicaResponse.readFrom(in); - return replicaResponse; - }); + final ActionListenerResponseHandler handler = new ActionListenerResponseHandler<>(listener, + ReplicaResponse::new); transportService.sendRequest(node, transportReplicaAction, replicaRequest, transportOptions, handler); } diff --git a/server/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java b/server/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java index a378bb6580d..89513d6e7e2 100644 --- a/server/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java +++ b/server/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequest.java @@ -60,7 +60,6 @@ public abstract class InstanceShardOperationRequest @Nullable private IndexRequest doc; - public UpdateRequest() { - - } + public UpdateRequest() {} public UpdateRequest(StreamInput in) throws IOException { super(in); @@ -871,11 +869,6 @@ public class UpdateRequest extends InstanceShardOperationRequest return this; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java b/server/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java index d442069b57f..3d0f4635219 100644 --- a/server/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java +++ b/server/src/main/java/org/elasticsearch/client/transport/TransportClientNodesService.java @@ -413,9 +413,7 @@ final class TransportClientNodesService implements Closeable { new FutureTransportResponseHandler() { @Override public LivenessResponse read(StreamInput in) throws IOException { - LivenessResponse response = new LivenessResponse(); - response.readFrom(in); - return response; + return new LivenessResponse(in); } }); transportService.sendRequest(connection, TransportLivenessAction.NAME, new LivenessRequest(), @@ -515,9 +513,7 @@ final class TransportClientNodesService implements Closeable { @Override public ClusterStateResponse read(StreamInput in) throws IOException { - final ClusterStateResponse clusterStateResponse = new ClusterStateResponse(); - clusterStateResponse.readFrom(in); - return clusterStateResponse; + return new ClusterStateResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java b/server/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java index 3413f32177c..fcb6113d3d7 100644 --- a/server/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java +++ b/server/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java @@ -455,11 +455,6 @@ public abstract class AbstractBulkByScrollRequest headers) { return new SearchTask(id, type, action, getDescription(), parentTaskId, headers); diff --git a/server/src/main/java/org/elasticsearch/search/fetch/ShardFetchSearchRequest.java b/server/src/main/java/org/elasticsearch/search/fetch/ShardFetchSearchRequest.java index b81d9eded9c..647d629a390 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/ShardFetchSearchRequest.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/ShardFetchSearchRequest.java @@ -73,8 +73,4 @@ public class ShardFetchSearchRequest extends ShardFetchRequest implements Indice return originalIndices.indicesOptions(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } -} diff --git a/server/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java b/server/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java index c551205f6b5..9d7ba557cc2 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java +++ b/server/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java @@ -71,11 +71,6 @@ public class InternalScrollSearchRequest extends TransportRequest { return this; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public Task createTask(long id, String type, String action, TaskId parentTaskId, Map headers) { return new SearchTask(id, type, action, getDescription(), parentTaskId, headers); diff --git a/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java b/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java index 9aae2df2777..bfea1300f7e 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java +++ b/server/src/main/java/org/elasticsearch/search/internal/ShardSearchTransportRequest.java @@ -163,11 +163,6 @@ public class ShardSearchTransportRequest extends TransportRequest implements Sha return shardSearchLocalRequest.preference(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public BytesReference cacheKey() throws IOException { return shardSearchLocalRequest.cacheKey(); diff --git a/server/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java b/server/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java index 4bb42bc3dc5..e458603310c 100644 --- a/server/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java +++ b/server/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java @@ -84,11 +84,6 @@ public class QuerySearchRequest extends TransportRequest implements IndicesReque return originalIndices.indicesOptions(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public Task createTask(long id, String type, String action, TaskId parentTaskId, Map headers) { return new SearchTask(id, type, action, getDescription(), parentTaskId, headers); diff --git a/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java b/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java index ed4c89ef222..3a37cafe9bb 100644 --- a/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java +++ b/server/src/main/java/org/elasticsearch/transport/RemoteClusterConnection.java @@ -208,9 +208,7 @@ final class RemoteClusterConnection implements TransportConnectionListener, Clos @Override public ClusterStateResponse read(StreamInput in) throws IOException { - ClusterStateResponse response = new ClusterStateResponse(); - response.readFrom(in); - return response; + return new ClusterStateResponse(in); } @Override @@ -567,9 +565,7 @@ final class RemoteClusterConnection implements TransportConnectionListener, Clos @Override public ClusterStateResponse read(StreamInput in) throws IOException { - ClusterStateResponse response = new ClusterStateResponse(); - response.readFrom(in); - return response; + return new ClusterStateResponse(in); } @Override diff --git a/server/src/main/java/org/elasticsearch/transport/TransportActionProxy.java b/server/src/main/java/org/elasticsearch/transport/TransportActionProxy.java index e1e3c25f083..ff351743b59 100644 --- a/server/src/main/java/org/elasticsearch/transport/TransportActionProxy.java +++ b/server/src/main/java/org/elasticsearch/transport/TransportActionProxy.java @@ -114,11 +114,6 @@ public final class TransportActionProxy { wrapped = reader.read(in); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java b/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java index b77ae83f67c..22c65bea248 100644 --- a/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java +++ b/server/src/main/java/org/elasticsearch/transport/TransportHandshaker.java @@ -171,7 +171,7 @@ final class TransportHandshaker { } HandshakeRequest(StreamInput streamInput) throws IOException { - super(streamInput); + super.readFrom(streamInput); BytesReference remainingMessage; try { remainingMessage = streamInput.readBytesReference(); @@ -213,7 +213,7 @@ final class TransportHandshaker { } private HandshakeResponse(StreamInput in) throws IOException { - super.readFrom(in); + super(in); responseVersion = Version.readVersion(in); } diff --git a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java index 5f9235b26cc..36d9fff5a3f 100644 --- a/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java +++ b/server/src/test/java/org/elasticsearch/action/ActionModuleTests.java @@ -88,14 +88,9 @@ public class ActionModuleTests extends ESTestCase { protected void doExecute(Task task, FakeRequest request, ActionListener listener) { } } - class FakeAction extends StreamableResponseActionType { + class FakeAction extends ActionType { protected FakeAction() { - super("fake"); - } - - @Override - public ActionResponse newResponse() { - return null; + super("fake", null); } } FakeAction action = new FakeAction(); diff --git a/server/src/test/java/org/elasticsearch/action/ActionTests.java b/server/src/test/java/org/elasticsearch/action/ActionTests.java index b9462ac68e7..aff22919942 100644 --- a/server/src/test/java/org/elasticsearch/action/ActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/ActionTests.java @@ -24,14 +24,9 @@ import org.elasticsearch.test.ESTestCase; public class ActionTests extends ESTestCase { public void testEquals() { - class FakeAction extends StreamableResponseActionType { + class FakeAction extends ActionType { protected FakeAction(String name) { - super(name); - } - - @Override - public ActionResponse newResponse() { - return null; + super(name, null); } } FakeAction fakeAction1 = new FakeAction("a"); diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java index 012f801698f..448ac1dde82 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java @@ -28,12 +28,13 @@ import org.elasticsearch.cluster.health.ClusterStateHealth; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; +import org.elasticsearch.test.AbstractSerializingTestCase; import org.hamcrest.Matchers; import java.io.IOException; @@ -49,7 +50,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.lessThanOrEqualTo; -public class ClusterHealthResponsesTests extends AbstractStreamableXContentTestCase { +public class ClusterHealthResponsesTests extends AbstractSerializingTestCase { private final ClusterHealthRequest.Level level = randomFrom(ClusterHealthRequest.Level.values()); public void testIsTimeout() { @@ -108,11 +109,6 @@ public class ClusterHealthResponsesTests extends AbstractStreamableXContentTestC return ClusterHealthResponse.fromXContent(parser); } - @Override - protected ClusterHealthResponse createBlankInstance() { - return new ClusterHealthResponse(); - } - @Override protected ClusterHealthResponse createTestInstance() { int indicesSize = randomInt(20); @@ -131,6 +127,11 @@ public class ClusterHealthResponsesTests extends AbstractStreamableXContentTestC TimeValue.timeValueMillis(randomInt(10000)), randomBoolean(), stateHealth); } + @Override + protected Writeable.Reader instanceReader() { + return ClusterHealthResponse::new; + } + @Override protected ToXContent.Params getToXContentParams() { return new ToXContent.MapParams(Collections.singletonMap("level", level.name().toLowerCase(Locale.ROOT))); diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponseTests.java index 17d1ecafabd..f51fc90ab11 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/snapshots/restore/RestoreSnapshotResponseTests.java @@ -40,7 +40,7 @@ public class RestoreSnapshotResponseTests extends AbstractXContentTestCase { - - @Override - protected ClusterStateResponse createBlankInstance() { - return new ClusterStateResponse(); - } +public class ClusterStateResponseTests extends AbstractWireSerializingTestCase { @Override protected ClusterStateResponse createTestInstance() { @@ -48,6 +44,11 @@ public class ClusterStateResponseTests extends AbstractStreamableTestCase instanceReader() { + return ClusterStateResponse::new; + } + @Override protected NamedWriteableRegistry getNamedWriteableRegistry() { return new NamedWriteableRegistry(ClusterModule.getNamedWriteables()); diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponseTests.java index 1c92c0c8c2b..8bea7fecc57 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/storedscripts/GetStoredScriptResponseTests.java @@ -17,18 +17,19 @@ package org.elasticsearch.action.admin.cluster.storedscripts;/* * under the License. */ +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.script.Script; import org.elasticsearch.script.StoredScriptSource; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; +import org.elasticsearch.test.AbstractSerializingTestCase; import java.io.IOException; import java.util.Collections; import java.util.Map; import java.util.function.Predicate; -public class GetStoredScriptResponseTests extends AbstractStreamableXContentTestCase { +public class GetStoredScriptResponseTests extends AbstractSerializingTestCase { @Override protected GetStoredScriptResponse doParseInstance(XContentParser parser) throws IOException { @@ -36,13 +37,13 @@ public class GetStoredScriptResponseTests extends AbstractStreamableXContentTest } @Override - protected GetStoredScriptResponse createBlankInstance() { - return new GetStoredScriptResponse(); + protected GetStoredScriptResponse createTestInstance() { + return new GetStoredScriptResponse(randomAlphaOfLengthBetween(1, 10), randomScriptSource()); } @Override - protected GetStoredScriptResponse createTestInstance() { - return new GetStoredScriptResponse(randomAlphaOfLengthBetween(1, 10), randomScriptSource()); + protected Writeable.Reader instanceReader() { + return GetStoredScriptResponse::new; } @Override diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponseTests.java index 6c15c419d09..d3bf9d73973 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/alias/get/GetAliasesResponseTests.java @@ -22,7 +22,8 @@ package org.elasticsearch.action.admin.indices.alias.get; import org.elasticsearch.cluster.metadata.AliasMetaData; import org.elasticsearch.cluster.metadata.AliasMetaData.Builder; import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.test.AbstractWireSerializingTestCase; import java.util.ArrayList; import java.util.HashSet; @@ -30,7 +31,7 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -public class GetAliasesResponseTests extends AbstractStreamableTestCase { +public class GetAliasesResponseTests extends AbstractWireSerializingTestCase { @Override protected GetAliasesResponse createTestInstance() { @@ -38,8 +39,8 @@ public class GetAliasesResponseTests extends AbstractStreamableTestCase instanceReader() { + return GetAliasesResponse::new; } @Override diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponseTests.java index 8bd76e2f4f2..26510985ad3 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/settings/get/GetSettingsResponseTests.java @@ -24,12 +24,13 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.settings.IndexScopedSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.RandomCreateIndexGenerator; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; import org.junit.Assert; +import org.elasticsearch.test.AbstractSerializingTestCase; import java.io.IOException; import java.util.Base64; @@ -42,7 +43,7 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; import static org.elasticsearch.index.IndexSettings.INDEX_REFRESH_INTERVAL_SETTING; -public class GetSettingsResponseTests extends AbstractStreamableXContentTestCase { +public class GetSettingsResponseTests extends AbstractSerializingTestCase { /* index.number_of_shards=2,index.number_of_replicas=1. The below base64'd bytes were generated by @@ -54,11 +55,6 @@ public class GetSettingsResponseTests extends AbstractStreamableXContentTestCase /* This response object was generated using similar code to the code used to create the above bytes */ private static final GetSettingsResponse TEST_6_2_2_RESPONSE_INSTANCE = getExpectedTest622Response(); - @Override - protected GetSettingsResponse createBlankInstance() { - return new GetSettingsResponse(); - } - @Override protected GetSettingsResponse createTestInstance() { HashMap indexToSettings = new HashMap<>(); @@ -100,6 +96,11 @@ public class GetSettingsResponseTests extends AbstractStreamableXContentTestCase return new GetSettingsResponse(immutableIndexToSettings, immutableIndexToDefaultSettings); } + @Override + protected Writeable.Reader instanceReader() { + return GetSettingsResponse::new; + } + @Override protected GetSettingsResponse doParseInstance(XContentParser parser) throws IOException { return GetSettingsResponse.fromXContent(parser); @@ -140,8 +141,7 @@ public class GetSettingsResponseTests extends AbstractStreamableXContentTestCase public void testCanDecode622Response() throws IOException { StreamInput si = StreamInput.wrap(Base64.getDecoder().decode(TEST_6_2_2_RESPONSE_BYTES)); si.setVersion(Version.V_6_2_2); - GetSettingsResponse response = new GetSettingsResponse(); - response.readFrom(si); + GetSettingsResponse response = new GetSettingsResponse(si); Assert.assertEquals(TEST_6_2_2_RESPONSE_INSTANCE, response); } diff --git a/server/src/test/java/org/elasticsearch/action/ingest/GetPipelineResponseTests.java b/server/src/test/java/org/elasticsearch/action/ingest/GetPipelineResponseTests.java index 95424acce77..48d4d09400b 100644 --- a/server/src/test/java/org/elasticsearch/action/ingest/GetPipelineResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/ingest/GetPipelineResponseTests.java @@ -20,13 +20,14 @@ package org.elasticsearch.action.ingest; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; +import org.elasticsearch.common.xcontent.ToXContent; +import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.ingest.PipelineConfiguration; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; +import org.elasticsearch.test.AbstractSerializingTestCase; import java.io.IOException; import java.io.UncheckedIOException; @@ -35,7 +36,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class GetPipelineResponseTests extends AbstractStreamableXContentTestCase { +public class GetPipelineResponseTests extends AbstractSerializingTestCase { private XContentBuilder getRandomXContentBuilder() throws IOException { XContentType xContentType = randomFrom(XContentType.values()); @@ -99,11 +100,6 @@ public class GetPipelineResponseTests extends AbstractStreamableXContentTestCase return GetPipelineResponse.fromXContent(parser); } - @Override - protected GetPipelineResponse createBlankInstance() { - return new GetPipelineResponse(); - } - @Override protected GetPipelineResponse createTestInstance() { try { @@ -113,6 +109,11 @@ public class GetPipelineResponseTests extends AbstractStreamableXContentTestCase } } + @Override + protected Writeable.Reader instanceReader() { + return GetPipelineResponse::new; + } + @Override protected boolean supportsUnknownFields() { return false; diff --git a/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java b/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java index 5b85761d44a..97306829e5a 100644 --- a/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/ingest/SimulatePipelineResponseTests.java @@ -47,8 +47,7 @@ public class SimulatePipelineResponseTests extends AbstractXContentTestCase { + Request() {} + + Request(StreamInput in) throws IOException { + super(in); + } + @Override public ActionRequestValidationException validate() { return null; @@ -134,6 +140,13 @@ public class TransportMasterNodeActionTests extends ESTestCase { class Response extends ActionResponse { private long identity = randomLong(); + Response() {} + + Response(StreamInput in) throws IOException { + super(in); + identity = in.readLong(); + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -151,19 +164,13 @@ public class TransportMasterNodeActionTests extends ESTestCase { public void writeTo(StreamOutput out) throws IOException { out.writeLong(identity); } - - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - identity = in.readLong(); - } } - class Action extends StreamableTransportMasterNodeAction { + class Action extends TransportMasterNodeAction { Action(String actionName, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { super(actionName, transportService, clusterService, threadPool, - new ActionFilters(new HashSet<>()), new IndexNameExpressionResolver(), Request::new); + new ActionFilters(new HashSet<>()), Request::new, new IndexNameExpressionResolver()); } @Override @@ -179,8 +186,8 @@ public class TransportMasterNodeActionTests extends ESTestCase { } @Override - protected Response newResponse() { - return new Response(); + protected Response read(StreamInput in) throws IOException { + return new Response(in); } @Override diff --git a/server/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java b/server/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java index 103b98bc586..a51dd5a5ac6 100644 --- a/server/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java +++ b/server/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationAllPermitsAcquisitionTests.java @@ -186,10 +186,7 @@ public class TransportReplicationAllPermitsAcquisitionTests extends IndexShardTe new TransportResponseHandler() { @Override public TransportReplicationAction.ReplicaResponse read(StreamInput in) throws IOException { - final TransportReplicationAction.ReplicaResponse replicaResponse - = new TransportReplicationAction.ReplicaResponse(); - replicaResponse.readFrom(in); - return replicaResponse; + return new TransportReplicationAction.ReplicaResponse(in); } @SuppressWarnings("unchecked") diff --git a/server/src/test/java/org/elasticsearch/indices/settings/InternalOrPrivateSettingsPlugin.java b/server/src/test/java/org/elasticsearch/indices/settings/InternalOrPrivateSettingsPlugin.java index 86391febd14..a646b27a40d 100644 --- a/server/src/test/java/org/elasticsearch/indices/settings/InternalOrPrivateSettingsPlugin.java +++ b/server/src/test/java/org/elasticsearch/indices/settings/InternalOrPrivateSettingsPlugin.java @@ -23,10 +23,10 @@ import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.StreamableResponseActionType; +import org.elasticsearch.action.ActionType; import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.master.MasterNodeRequest; -import org.elasticsearch.action.support.master.StreamableTransportMasterNodeAction; +import org.elasticsearch.action.support.master.TransportMasterNodeAction; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterStateUpdateTask; import org.elasticsearch.cluster.block.ClusterBlockException; @@ -62,13 +62,13 @@ public class InternalOrPrivateSettingsPlugin extends Plugin implements ActionPlu return Arrays.asList(INDEX_INTERNAL_SETTING, INDEX_PRIVATE_SETTING); } - public static class UpdateInternalOrPrivateAction extends StreamableResponseActionType { + public static class UpdateInternalOrPrivateAction extends ActionType { public static final UpdateInternalOrPrivateAction INSTANCE = new UpdateInternalOrPrivateAction(); private static final String NAME = "indices:admin/settings/update-internal-or-private-index"; public UpdateInternalOrPrivateAction() { - super(NAME); + super(NAME, UpdateInternalOrPrivateAction.Response::new); } public static class Request extends MasterNodeRequest { @@ -108,19 +108,20 @@ public class InternalOrPrivateSettingsPlugin extends Plugin implements ActionPlu } static class Response extends ActionResponse { + Response() {} + + Response(StreamInput in) throws IOException { + super(in); + } + @Override public void writeTo(StreamOutput out) throws IOException {} } - @Override - public UpdateInternalOrPrivateAction.Response newResponse() { - return new UpdateInternalOrPrivateAction.Response(); - } - } public static class TransportUpdateInternalOrPrivateAction - extends StreamableTransportMasterNodeAction { + extends TransportMasterNodeAction { @Inject public TransportUpdateInternalOrPrivateAction( @@ -145,8 +146,8 @@ public class InternalOrPrivateSettingsPlugin extends Plugin implements ActionPlu } @Override - protected UpdateInternalOrPrivateAction.Response newResponse() { - return new UpdateInternalOrPrivateAction.Response(); + protected UpdateInternalOrPrivateAction.Response read(StreamInput in) throws IOException { + return new UpdateInternalOrPrivateAction.Response(in); } @Override diff --git a/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java b/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java index 96e1da6e831..e8927b57616 100644 --- a/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java +++ b/server/src/test/java/org/elasticsearch/transport/TransportActionProxyTests.java @@ -234,11 +234,6 @@ public class TransportActionProxyTests extends ESTestCase { this.targetNode = in.readString(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(targetNode); diff --git a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java index c1fbdec870b..47abfd5fa2b 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/AbstractSimpleTransportTestCase.java @@ -1172,10 +1172,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase { this.message = in.readString(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } + @Override public void writeTo(StreamOutput out) throws IOException { @@ -1235,10 +1232,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase { this.value1 = in.readInt(); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } + @Override public void writeTo(StreamOutput out) throws IOException { @@ -1264,10 +1258,7 @@ public abstract class AbstractSimpleTransportTestCase extends ESTestCase { } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } + @Override public void writeTo(StreamOutput out) throws IOException { diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java index 8ef9356f944..39b11f08ec6 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/ShardChangesAction.java @@ -280,11 +280,6 @@ public class ShardChangesAction extends ActionType this.tookInMillis = tookInMillis; } - @Override - public void readFrom(final StreamInput in) { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(final StreamOutput out) throws IOException { out.writeVLong(mappingVersion); diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/ClearCcrRestoreSessionRequest.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/ClearCcrRestoreSessionRequest.java index b9d277ca1b4..9cc9ca05b09 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/ClearCcrRestoreSessionRequest.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/ClearCcrRestoreSessionRequest.java @@ -21,7 +21,7 @@ public class ClearCcrRestoreSessionRequest extends ActionRequest implements Remo private String sessionUUID; ClearCcrRestoreSessionRequest(StreamInput in) throws IOException { - super.readFrom(in); + super(in); sessionUUID = in.readString(); } @@ -35,11 +35,6 @@ public class ClearCcrRestoreSessionRequest extends ActionRequest implements Remo return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException(); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/DeleteInternalCcrRepositoryRequest.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/DeleteInternalCcrRepositoryRequest.java index 12264c1d57c..eefecbcc549 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/DeleteInternalCcrRepositoryRequest.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/DeleteInternalCcrRepositoryRequest.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.ccr.action.repositories; import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import java.io.IOException; @@ -27,11 +26,6 @@ public class DeleteInternalCcrRepositoryRequest extends ActionRequest { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("DeleteInternalRepositoryRequest cannot be serialized for sending across the wire."); - } - @Override public void writeTo(StreamOutput out) throws IOException { throw new UnsupportedOperationException("DeleteInternalRepositoryRequest cannot be serialized for sending across the wire."); diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/GetCcrRestoreFileChunkRequest.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/GetCcrRestoreFileChunkRequest.java index 5da0efcb372..39baeeb73f4 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/GetCcrRestoreFileChunkRequest.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/GetCcrRestoreFileChunkRequest.java @@ -51,11 +51,6 @@ public class GetCcrRestoreFileChunkRequest extends ActionRequest implements Remo out.writeVInt(size); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException(); - } - String getSessionUUID() { return sessionUUID; } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/PutCcrRestoreSessionAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/PutCcrRestoreSessionAction.java index 14e105248c0..d5742de3bec 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/PutCcrRestoreSessionAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/PutCcrRestoreSessionAction.java @@ -103,11 +103,6 @@ public class PutCcrRestoreSessionAction extends ActionType categories = EnumSet.noneOf(Category.class); + int size = in.readVInt(); + for (int i = 0; i < size; i++) { + categories.add(Category.valueOf(in.readString())); + } + this.categories = categories; + } + public void setVerbose(boolean verbose) { this.verbose = verbose; } @@ -64,17 +75,6 @@ public class XPackInfoRequest extends ActionRequest { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - this.verbose = in.readBoolean(); - EnumSet categories = EnumSet.noneOf(Category.class); - int size = in.readVInt(); - for (int i = 0; i < size; i++) { - categories.add(Category.valueOf(in.readString())); - } - this.categories = categories; - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(verbose); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoResponse.java index 7259c927ff5..f4e61432969 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoResponse.java @@ -85,11 +85,6 @@ public class XPackInfoResponse extends ActionResponse implements ToXContentObjec out.writeOptionalWriteable(featureSetsInfo); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public boolean equals(Object other) { if (other == null || other.getClass() != getClass()) return false; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreRequest.java index 6c3bc0e6b81..29c831438f9 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreRequest.java @@ -187,11 +187,6 @@ public class GraphExploreRequest extends ActionRequest implements IndicesRequest return this; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreResponse.java index 2242b97cbd8..dc6702d0009 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreResponse.java @@ -114,11 +114,6 @@ public class GraphExploreResponse extends ActionResponse implements ToXContentOb return shardFailures; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - public Collection getConnections() { return connections.values(); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/migration/IndexUpgradeInfoResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/migration/IndexUpgradeInfoResponse.java index ba0896a04b5..a698529f9eb 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/migration/IndexUpgradeInfoResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/migration/IndexUpgradeInfoResponse.java @@ -32,11 +32,6 @@ public class IndexUpgradeInfoResponse extends ActionResponse implements ToXConte this.actions = actions; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeMap(actions, StreamOutput::writeString, (out1, value) -> value.writeTo(out1)); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchRequest.java index d29e1013c97..6bd18e490bc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchRequest.java @@ -59,11 +59,6 @@ public class DeleteWatchRequest extends ActionRequest { return validationException; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchResponse.java index 527a1be5de7..cb15d67c611 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/DeleteWatchResponse.java @@ -85,11 +85,6 @@ public class DeleteWatchResponse extends ActionResponse implements ToXContentObj return Objects.hash(id, version, found); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(id); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchRequest.java index 1edbe62518c..fbdea0cf040 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchRequest.java @@ -58,11 +58,6 @@ public final class PutWatchRequest extends ActionRequest { this.xContentType = xContentType; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchResponse.java index 7d4e06503d0..7e116786ebd 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/watcher/PutWatchResponse.java @@ -121,11 +121,6 @@ public class PutWatchResponse extends ActionResponse implements ToXContentObject out.writeBoolean(created); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { return builder.startObject() diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesRequest.java index 70d9ffdf133..7d86862d0cd 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesRequest.java @@ -66,11 +66,6 @@ public abstract class AbstractGetResourcesRequest extends ActionRequest { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesResponse.java index a903e75ef4b..56e54284764 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/AbstractGetResourcesResponse.java @@ -39,11 +39,6 @@ public abstract class AbstractGetResourcesResponse featureSets) { - super(XPackInfoAction.NAME, transportService, XPackInfoRequest::new, actionFilters); + super(XPackInfoAction.NAME, transportService, actionFilters, XPackInfoRequest::new); this.licenseService = licenseService; this.featureSets = featureSets; } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageResponse.java index e6f8a5260b8..b39ca2c8ed8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/action/XPackUsageResponse.java @@ -43,8 +43,4 @@ public class XPackUsageResponse extends ActionResponse { } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java index c31b05d2815..39f1cc20fa8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/GetAutoFollowPatternAction.java @@ -87,7 +87,7 @@ public class GetAutoFollowPatternAction extends ActionType return builder; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeList(policies); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetStatusAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetStatusAction.java index 141fff89ac7..74e3128548d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetStatusAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetStatusAction.java @@ -53,11 +53,6 @@ public class GetStatusAction extends ActionType { return builder; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeEnum(mode); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java index 2c441f524a4..76996b08799 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java @@ -76,11 +76,6 @@ public class RemoveIndexLifecyclePolicyAction extends ActionType return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/EvaluateDataFrameAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/EvaluateDataFrameAction.java index 1b445e796f0..04b5d084a76 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/EvaluateDataFrameAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/EvaluateDataFrameAction.java @@ -105,11 +105,6 @@ public class EvaluateDataFrameAction extends ActionType { } public Request(StreamInput in) throws IOException { - super.readFrom(in); + super(in); jobId = in.readString(); timestamp = in.readOptionalString(); expand = in.readBoolean(); @@ -208,11 +208,6 @@ public class GetBucketsAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCalendarEventsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCalendarEventsAction.java index 1fb164fdb72..ac2839373dc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCalendarEventsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCalendarEventsAction.java @@ -133,11 +133,6 @@ public class GetCalendarEventsAction extends ActionType return validationException; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCategoriesAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCategoriesAction.java index 96c11ea6bf3..e37cbd77bc6 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCategoriesAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetCategoriesAction.java @@ -111,11 +111,6 @@ public class GetCategoriesAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/MlInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/MlInfoAction.java index 014a79cdc12..e342f4a5021 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/MlInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/MlInfoAction.java @@ -74,11 +74,6 @@ public class MlInfoAction extends ActionType { return info; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeMap(info); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PostCalendarEventsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PostCalendarEventsAction.java index dd143e57160..20c0dd3c0ea 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PostCalendarEventsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PostCalendarEventsAction.java @@ -97,11 +97,6 @@ public class PostCalendarEventsAction extends ActionType { return validationException; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); @@ -149,11 +144,6 @@ public class PutCalendarAction extends ActionType { this.calendar = calendar; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().before(Version.V_6_3_0)) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java index ed6a9cd784b..48c9be28192 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java @@ -110,11 +110,6 @@ public class PutDataFrameAnalyticsAction extends ActionType { return datafeed; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().before(Version.V_6_3_0)) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutFilterAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutFilterAction.java index b15a90bdb09..ca8e334b555 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutFilterAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutFilterAction.java @@ -72,11 +72,6 @@ public class PutFilterAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); @@ -130,11 +125,6 @@ public class PutFilterAction extends ActionType { this.filter = filter; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { filter.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java index fca9457b9b9..362d927d243 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java @@ -145,11 +145,6 @@ public class PutJobAction extends ActionType { return job; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().before(Version.V_6_3_0)) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java index e8dfbd87638..9550d6fa902 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java @@ -169,11 +169,6 @@ public class RevertModelSnapshotAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateModelSnapshotAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateModelSnapshotAction.java index 2e46122e998..04ac3c8deca 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateModelSnapshotAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateModelSnapshotAction.java @@ -110,11 +110,6 @@ public class UpdateModelSnapshotAction extends ActionType { detector.writeTo(out); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { detector.toXContent(builder, params); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java index 83a993848f7..4830ea711e0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/ValidateJobConfigAction.java @@ -92,11 +92,6 @@ public class ValidateJobConfigAction extends ActionType { job.writeTo(out); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public int hashCode() { return Objects.hash(job); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkRequest.java index 77f4ecfdbf2..5c1d700343f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkRequest.java @@ -102,11 +102,6 @@ public class MonitoringBulkRequest extends ActionRequest { return this; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkResponse.java index 4058c47f0bc..274485f38de 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/action/MonitoringBulkResponse.java @@ -83,11 +83,6 @@ public class MonitoringBulkResponse extends ActionResponse { return error; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVLong(tookInMillis); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java index 10ce1138728..c483940aab5 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/GetRollupCapsAction.java @@ -60,11 +60,6 @@ public class GetRollupCapsAction extends ActionType 0; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(roles.length); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java index 78ac96487fb..6a48a814eba 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java @@ -176,11 +176,6 @@ public class PutRoleRequest extends ActionRequest implements WriteRequest 0; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(mappings.length); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingRequest.java index 61cb21b5e35..b25e309c1af 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingRequest.java @@ -144,11 +144,6 @@ public class PutRoleMappingRequest extends ActionRequest return metadata; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingResponse.java index 114e8cb09b7..e7f5ea9ead3 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/rolemapping/PutRoleMappingResponse.java @@ -46,8 +46,4 @@ public class PutRoleMappingResponse extends ActionResponse implements ToXContent out.writeBoolean(created); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlAuthenticateResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlAuthenticateResponse.java index bd64da64e99..aa11093236a 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlAuthenticateResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlAuthenticateResponse.java @@ -62,8 +62,4 @@ public final class SamlAuthenticateResponse extends ActionResponse { out.writeTimeValue(expiresIn); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlInvalidateSessionResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlInvalidateSessionResponse.java index fd950d92c8e..af051eb696f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlInvalidateSessionResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlInvalidateSessionResponse.java @@ -51,10 +51,4 @@ public final class SamlInvalidateSessionResponse extends ActionResponse { out.writeInt(count); out.writeString(redirectUrl); } - - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlLogoutResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlLogoutResponse.java index 70ecfb761ed..dc176b61134 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlLogoutResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlLogoutResponse.java @@ -36,9 +36,4 @@ public final class SamlLogoutResponse extends ActionResponse { out.writeString(redirectUrl); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationRequest.java index 13a17752dde..21ec96ca9a2 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationRequest.java @@ -5,14 +5,14 @@ */ package org.elasticsearch.xpack.core.security.action.saml; -import java.io.IOException; - import org.elasticsearch.action.ActionRequest; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; +import java.io.IOException; + /** * Represents a request to prepare a SAML {@code <AuthnRequest>}. */ @@ -62,11 +62,6 @@ public final class SamlPrepareAuthenticationRequest extends ActionRequest { '}'; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationResponse.java index fc2a0b29571..942d7d0b0af 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/saml/SamlPrepareAuthenticationResponse.java @@ -48,9 +48,4 @@ public final class SamlPrepareAuthenticationResponse extends ActionResponse { out.writeString(redirectUrl); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java index 7dafc9388e6..2607a44b452 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java @@ -246,9 +246,4 @@ public final class CreateTokenRequest extends ActionRequest { } out.writeOptionalString(scope); } - - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenResponse.java index cd1da18bf76..efcf0a19e20 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenResponse.java @@ -90,11 +90,6 @@ public final class CreateTokenResponse extends ActionResponse implements ToXCont out.writeOptionalString(kerberosAuthenticationResponseToken); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject() diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java index c33c6c9d606..94f3ac7c15e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java @@ -150,9 +150,4 @@ public final class InvalidateTokenRequest extends ActionRequest { out.writeOptionalString(realmName); out.writeOptionalString(userName); } - - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenResponse.java index 315c5fb6ad2..09f82f4084c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenResponse.java @@ -43,11 +43,6 @@ public final class InvalidateTokenResponse extends ActionResponse implements ToX result.writeTo(out); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException { result.toXContent(builder, params); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateRequest.java index ccdf42d6c80..17a38263e8f 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateRequest.java @@ -46,11 +46,6 @@ public class AuthenticateRequest extends ActionRequest implements UserRequest { return new String[] { username }; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateResponse.java index d94aea06a4e..86e8e0acdc3 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/AuthenticateResponse.java @@ -46,9 +46,4 @@ public class AuthenticateResponse extends ActionResponse { } } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ChangePasswordRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ChangePasswordRequest.java index d5b9cbc953c..031448bbff7 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ChangePasswordRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/ChangePasswordRequest.java @@ -85,11 +85,6 @@ public class ChangePasswordRequest extends ActionRequest return new String[] { username }; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserRequest.java index 6046d6d8780..edca26060c7 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserRequest.java @@ -69,11 +69,6 @@ public class DeleteUserRequest extends ActionRequest implements UserRequest, Wri return new String[] { username }; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserResponse.java index 97c5a5d73ca..616d47de068 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/DeleteUserResponse.java @@ -40,11 +40,6 @@ public class DeleteUserResponse extends ActionResponse implements ToXContentObje return this.found; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(found); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesRequest.java index 972e881cc38..490c7c72369 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesRequest.java @@ -54,16 +54,6 @@ public final class GetUserPrivilegesRequest extends ActionRequest implements Use return new String[] { username }; } - /** - * Always throws {@link UnsupportedOperationException} as this object should be deserialized using - * the {@link #GetUserPrivilegesRequest(StreamInput)} constructor instead. - */ - @Override - @Deprecated - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("Use " + getClass() + " as Writeable not Streamable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponse.java index 79324308408..6f91a001273 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUserPrivilegesResponse.java @@ -78,10 +78,6 @@ public final class GetUserPrivilegesResponse extends ActionResponse { return runAs; } - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeCollection(cluster, StreamOutput::writeString); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersRequest.java index 3a3d5b949c6..ade97805e79 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersRequest.java @@ -49,11 +49,6 @@ public class GetUsersRequest extends ActionRequest implements UserRequest { return usernames; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java index 4302d862771..62cc7e26416 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/GetUsersResponse.java @@ -49,11 +49,6 @@ public class GetUsersResponse extends ActionResponse { return users != null && users.length > 0; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(users == null ? -1 : users.length); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesRequest.java index fc0419a9ec5..2e0aaaf1bf5 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesRequest.java @@ -115,11 +115,6 @@ public class HasPrivilegesRequest extends ActionRequest implements UserRequest { this.applicationPrivileges = appPrivileges; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java index 09628113896..6909526f3cb 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/HasPrivilegesResponse.java @@ -119,10 +119,6 @@ public class HasPrivilegesResponse extends ActionResponse implements ToXContentO return Objects.hash(username, completeMatch, cluster, index, application); } - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - private static Set readResourcePrivileges(StreamInput in) throws IOException { final int count = in.readVInt(); final Set set = new TreeSet<>(Comparator.comparing(o -> o.getResource())); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java index d0bb99a46a2..578793661f4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserRequest.java @@ -144,11 +144,6 @@ public class PutUserRequest extends ActionRequest implements UserRequest, WriteR return new String[] { username }; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserResponse.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserResponse.java index 2b06a6e7bd3..0e5866f61fb 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserResponse.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/PutUserResponse.java @@ -40,11 +40,6 @@ public class PutUserResponse extends ActionResponse implements ToXContentObject out.writeBoolean(created); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { return builder.startObject() diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/SetEnabledRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/SetEnabledRequest.java index b352d1111b2..28e161dd8b3 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/SetEnabledRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/user/SetEnabledRequest.java @@ -97,11 +97,6 @@ public class SetEnabledRequest extends ActionRequest implements UserRequest, Wri return this; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/GetCertificateInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/GetCertificateInfoAction.java index bbe20b9396b..47dd396be08 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/GetCertificateInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/GetCertificateInfoAction.java @@ -36,6 +36,12 @@ public class GetCertificateInfoAction extends ActionType { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/TransportGetCertificateInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/TransportGetCertificateInfoAction.java index 41e8187f140..0c9f65540e0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/TransportGetCertificateInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/action/TransportGetCertificateInfoAction.java @@ -25,8 +25,7 @@ public class TransportGetCertificateInfoAction extends HandledTransportAction DataFrameTransformsCheckpointService.extractIndexCheckPoints(shardStatsArray, indices)); - assertThat(e.getMessage(), containsString("Global checkpoints mismatch")); } + assertThat(e.getMessage(), containsString("Global checkpoints mismatch")); + } /** * Create a random set of 3 index names diff --git a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlRequest.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlRequest.java index ea5cce74ed3..f5965cc0e68 100644 --- a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlRequest.java +++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlRequest.java @@ -51,11 +51,6 @@ public abstract class AbstractSqlRequest extends ActionRequest implements ToXCon return validationException; } - @Override - public final void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponse.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponse.java index 3cdaf01b29b..4ac4fc9c84e 100644 --- a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponse.java +++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlClearCursorResponse.java @@ -60,11 +60,6 @@ public class SqlClearCursorResponse extends ActionResponse implements StatusToXC return builder; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(succeeded); diff --git a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryResponse.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryResponse.java index 95c79b10ff6..5553b444460 100644 --- a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryResponse.java +++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlQueryResponse.java @@ -117,11 +117,6 @@ public class SqlQueryResponse extends ActionResponse implements ToXContentObject return this; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(cursor); diff --git a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponse.java b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponse.java index 478cef791be..8863788f5ee 100644 --- a/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponse.java +++ b/x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/SqlTranslateResponse.java @@ -34,11 +34,6 @@ public class SqlTranslateResponse extends ActionResponse implements ToXContentOb return source; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { source.writeTo(out);