From cbd2b6cc41afa66fcaad41fea7f6d0a36f9f76f5 Mon Sep 17 00:00:00 2001 From: David Pilato Date: Fri, 17 Apr 2015 10:25:48 +0200 Subject: [PATCH] [java] Deprecate `async` replication in java API Follow up for PR #10171. As we discussed https://github.com/elastic/elasticsearch/issues/10114#issuecomment-87989649, we should also mark the code as deprecated so plugin developers know in advance that they need to adapt their code. --- .../java/org/elasticsearch/action/bulk/BulkRequest.java | 6 ++++++ .../org/elasticsearch/action/bulk/BulkRequestBuilder.java | 2 ++ .../IndicesReplicationOperationRequestBuilder.java | 4 ++++ .../action/support/replication/ReplicationType.java | 2 ++ .../replication/ShardReplicationOperationRequest.java | 6 ++++++ .../ShardReplicationOperationRequestBuilder.java | 4 ++++ .../java/org/elasticsearch/action/update/UpdateRequest.java | 4 ++++ .../elasticsearch/action/update/UpdateRequestBuilder.java | 2 ++ 8 files changed, 30 insertions(+) diff --git a/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java b/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java index 309227c04029b..7c46b485cb895 100644 --- a/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java +++ b/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java @@ -424,12 +424,18 @@ public boolean refresh() { /** * Set the replication type for this operation. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated public BulkRequest replicationType(ReplicationType replicationType) { this.replicationType = replicationType; return this; } + /** + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 + */ + @Deprecated public ReplicationType replicationType() { return this.replicationType; } diff --git a/src/main/java/org/elasticsearch/action/bulk/BulkRequestBuilder.java b/src/main/java/org/elasticsearch/action/bulk/BulkRequestBuilder.java index bb4ba9c779756..f23f890e351ab 100644 --- a/src/main/java/org/elasticsearch/action/bulk/BulkRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/bulk/BulkRequestBuilder.java @@ -112,7 +112,9 @@ public BulkRequestBuilder add(byte[] data, int from, int length, @Nullable Strin /** * Set the replication type for this operation. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated public BulkRequestBuilder setReplicationType(ReplicationType replicationType) { request.replicationType(replicationType); return this; diff --git a/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequestBuilder.java b/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequestBuilder.java index 07590946d3df4..03ccf652ae2a5 100644 --- a/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/support/replication/IndicesReplicationOperationRequestBuilder.java @@ -71,7 +71,9 @@ public RequestBuilder setIndicesOptions(IndicesOptions indicesOptions) { /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated @SuppressWarnings("unchecked") public RequestBuilder setReplicationType(ReplicationType replicationType) { request.replicationType(replicationType); @@ -80,7 +82,9 @@ public RequestBuilder setReplicationType(ReplicationType replicationType) { /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated @SuppressWarnings("unchecked") public RequestBuilder setReplicationType(String replicationType) { request.replicationType(replicationType); diff --git a/src/main/java/org/elasticsearch/action/support/replication/ReplicationType.java b/src/main/java/org/elasticsearch/action/support/replication/ReplicationType.java index 9ee279d1bdebd..d9c0338ce6444 100644 --- a/src/main/java/org/elasticsearch/action/support/replication/ReplicationType.java +++ b/src/main/java/org/elasticsearch/action/support/replication/ReplicationType.java @@ -23,7 +23,9 @@ /** * The type of replication to perform. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ +@Deprecated public enum ReplicationType { /** * Sync replication, wait till all replicas have performed the operation. diff --git a/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java b/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java index ee25c14362ddc..99346cfcb7514 100644 --- a/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java +++ b/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequest.java @@ -151,14 +151,18 @@ public IndicesOptions indicesOptions() { /** * The replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated public ReplicationType replicationType() { return this.replicationType; } /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated @SuppressWarnings("unchecked") public final T replicationType(ReplicationType replicationType) { this.replicationType = replicationType; @@ -167,7 +171,9 @@ public final T replicationType(ReplicationType replicationType) { /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated public final T replicationType(String replicationType) { return replicationType(ReplicationType.fromString(replicationType)); } diff --git a/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequestBuilder.java b/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequestBuilder.java index e33ecab2e6b13..8be3533145882 100644 --- a/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/support/replication/ShardReplicationOperationRequestBuilder.java @@ -70,7 +70,9 @@ public final RequestBuilder setIndex(String index) { /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated @SuppressWarnings("unchecked") public RequestBuilder setReplicationType(ReplicationType replicationType) { request.replicationType(replicationType); @@ -79,7 +81,9 @@ public RequestBuilder setReplicationType(ReplicationType replicationType) { /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated @SuppressWarnings("unchecked") public RequestBuilder setReplicationType(String replicationType) { request.replicationType(replicationType); diff --git a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java index 7d2531d0d228b..1d56098ea2f0d 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateRequest.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateRequest.java @@ -375,14 +375,18 @@ public boolean refresh() { /** * The replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated public ReplicationType replicationType() { return this.replicationType; } /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated public UpdateRequest replicationType(ReplicationType replicationType) { this.replicationType = replicationType; return this; diff --git a/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java b/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java index 640369288eae9..aaec8d7c222f5 100644 --- a/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java +++ b/src/main/java/org/elasticsearch/action/update/UpdateRequestBuilder.java @@ -165,7 +165,9 @@ public UpdateRequestBuilder setRefresh(boolean refresh) { /** * Sets the replication type. + * @deprecated will be removed in 2.0.0. See https://github.com/elastic/elasticsearch/pull/10171 */ + @Deprecated public UpdateRequestBuilder setReplicationType(ReplicationType replicationType) { request.replicationType(replicationType); return this;