Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport support for cancelling requests #46592

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ bouncycastle = 1.61
# test dependencies
randomizedrunner = 2.7.1
junit = 4.12
httpclient = 4.5.8
httpcore = 4.4.11
httpclient = 4.5.10
httpcore = 4.4.12
httpasyncclient = 4.1.4
commonslogging = 1.1.3
commonscodec = 1.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ public PutFollowResponse putFollow(PutFollowRequest request, RequestOptions opti
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-follow.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void putFollowAsync(PutFollowRequest request,
RequestOptions options,
ActionListener<PutFollowResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable putFollowAsync(PutFollowRequest request,
RequestOptions options,
ActionListener<PutFollowResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::putFollow,
options,
Expand Down Expand Up @@ -129,15 +129,15 @@ public AcknowledgedResponse pauseFollow(PauseFollowRequest request, RequestOptio
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-pause-follow.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void pauseFollowAsync(PauseFollowRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable pauseFollowAsync(PauseFollowRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::pauseFollow,
options,
Expand Down Expand Up @@ -172,15 +172,15 @@ public AcknowledgedResponse resumeFollow(ResumeFollowRequest request, RequestOpt
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-resume-follow.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void resumeFollowAsync(ResumeFollowRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable resumeFollowAsync(ResumeFollowRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::resumeFollow,
options,
Expand Down Expand Up @@ -217,15 +217,15 @@ public AcknowledgedResponse unfollow(UnfollowRequest request, RequestOptions opt
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-unfollow.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void unfollowAsync(UnfollowRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable unfollowAsync(UnfollowRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::unfollow,
options,
Expand Down Expand Up @@ -260,15 +260,15 @@ public BroadcastResponse forgetFollower(final ForgetFollowerRequest request, fin
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-forget-follower.html">the docs</a> for more details
* on the intended usage of this API.
*
* @param request the request
* @param options the request options (e.g., headers), use {@link RequestOptions#DEFAULT} if the defaults are acceptable.
* @return cancellable that may be used to cancel the request
*/
public void forgetFollowerAsync(
public Cancellable forgetFollowerAsync(
final ForgetFollowerRequest request,
final RequestOptions options,
final ActionListener<BroadcastResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::forgetFollower,
options,
Expand Down Expand Up @@ -303,15 +303,15 @@ public AcknowledgedResponse putAutoFollowPattern(PutAutoFollowPatternRequest req
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-put-auto-follow-pattern.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void putAutoFollowPatternAsync(PutAutoFollowPatternRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable putAutoFollowPatternAsync(PutAutoFollowPatternRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::putAutoFollowPattern,
options,
Expand Down Expand Up @@ -347,15 +347,15 @@ public AcknowledgedResponse deleteAutoFollowPattern(DeleteAutoFollowPatternReque
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void deleteAutoFollowPatternAsync(DeleteAutoFollowPatternRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable deleteAutoFollowPatternAsync(DeleteAutoFollowPatternRequest request,
RequestOptions options,
ActionListener<AcknowledgedResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::deleteAutoFollowPattern,
options,
Expand Down Expand Up @@ -392,15 +392,15 @@ public GetAutoFollowPatternResponse getAutoFollowPattern(GetAutoFollowPatternReq
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-auto-follow-pattern.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void getAutoFollowPatternAsync(GetAutoFollowPatternRequest request,
RequestOptions options,
ActionListener<GetAutoFollowPatternResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable getAutoFollowPatternAsync(GetAutoFollowPatternRequest request,
RequestOptions options,
ActionListener<GetAutoFollowPatternResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::getAutoFollowPattern,
options,
Expand Down Expand Up @@ -437,14 +437,14 @@ public CcrStatsResponse getCcrStats(CcrStatsRequest request,
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-stats.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return cancellable that may be used to cancel the request
*/
public void getCcrStatsAsync(CcrStatsRequest request,
RequestOptions options,
ActionListener<CcrStatsResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable getCcrStatsAsync(CcrStatsRequest request,
RequestOptions options,
ActionListener<CcrStatsResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::getCcrStats,
options,
Expand Down Expand Up @@ -481,14 +481,14 @@ public FollowStatsResponse getFollowStats(FollowStatsRequest request,
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-stats.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return cancellable that may be used to cancel the request
*/
public void getFollowStatsAsync(FollowStatsRequest request,
RequestOptions options,
ActionListener<FollowStatsResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable getFollowStatsAsync(FollowStatsRequest request,
RequestOptions options,
ActionListener<FollowStatsResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::getFollowStats,
options,
Expand Down Expand Up @@ -524,14 +524,14 @@ public FollowInfoResponse getFollowInfo(FollowInfoRequest request, RequestOption
*
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-get-follow-info.html">
* the docs</a> for more.
*
* @param request the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return cancellable that may be used to cancel the request
*/
public void getFollowInfoAsync(FollowInfoRequest request,
RequestOptions options,
ActionListener<FollowInfoResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(
public Cancellable getFollowInfoAsync(FollowInfoRequest request,
RequestOptions options,
ActionListener<FollowInfoResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
request,
CcrRequestConverters::getFollowInfo,
options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ public ClusterUpdateSettingsResponse putSettings(ClusterUpdateSettingsRequest cl
* @param clusterUpdateSettingsRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options,
ActionListener<ClusterUpdateSettingsResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest, ClusterRequestConverters::clusterPutSettings,
public Cancellable putSettingsAsync(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options,
ActionListener<ClusterUpdateSettingsResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(clusterUpdateSettingsRequest,
ClusterRequestConverters::clusterPutSettings,
options, ClusterUpdateSettingsResponse::fromXContent, listener, emptySet());
}

Expand All @@ -96,10 +98,12 @@ public ClusterGetSettingsResponse getSettings(ClusterGetSettingsRequest clusterG
* @param clusterGetSettingsRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void getSettingsAsync(ClusterGetSettingsRequest clusterGetSettingsRequest, RequestOptions options,
ActionListener<ClusterGetSettingsResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(clusterGetSettingsRequest, ClusterRequestConverters::clusterGetSettings,
public Cancellable getSettingsAsync(ClusterGetSettingsRequest clusterGetSettingsRequest, RequestOptions options,
ActionListener<ClusterGetSettingsResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(
clusterGetSettingsRequest, ClusterRequestConverters::clusterGetSettings,
options, ClusterGetSettingsResponse::fromXContent, listener, emptySet());
}

Expand Down Expand Up @@ -127,9 +131,11 @@ public ClusterHealthResponse health(ClusterHealthRequest healthRequest, RequestO
* @param healthRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @param listener the listener to be notified upon request completion
* @return cancellable that may be used to cancel the request
*/
public void healthAsync(ClusterHealthRequest healthRequest, RequestOptions options, ActionListener<ClusterHealthResponse> listener) {
restHighLevelClient.performRequestAsyncAndParseEntity(healthRequest, ClusterRequestConverters::clusterHealth, options,
public Cancellable healthAsync(ClusterHealthRequest healthRequest, RequestOptions options,
ActionListener<ClusterHealthResponse> listener) {
return restHighLevelClient.performRequestAsyncAndParseEntity(healthRequest, ClusterRequestConverters::clusterHealth, options,
ClusterHealthResponse::fromXContent, listener, singleton(RestStatus.REQUEST_TIMEOUT.getStatus()));
}
}
Loading