From 553d0cbeb39e1e6c3bc1c39b25da2b2badb2180c Mon Sep 17 00:00:00 2001 From: danoswaltCL <97542869+danoswaltCL@users.noreply.github.com> Date: Mon, 20 Nov 2023 14:22:41 -0500 Subject: [PATCH] merge down java retries change (#1058) --- clientlibs/java/pom.xml | 4 ++-- .../org/upgradeplatform/utils/PublishingRetryCallback.java | 6 +++++- .../java/src/main/java/org/upgradeplatform/utils/Utils.java | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/clientlibs/java/pom.xml b/clientlibs/java/pom.xml index 56d111515f..51d4ad9aa4 100644 --- a/clientlibs/java/pom.xml +++ b/clientlibs/java/pom.xml @@ -9,9 +9,9 @@ at the same time that happen to rev to the same new version will be caught by a merge conflict. --> - + - 4.1.13 + 4.1.14 diff --git a/clientlibs/java/src/main/java/org/upgradeplatform/utils/PublishingRetryCallback.java b/clientlibs/java/src/main/java/org/upgradeplatform/utils/PublishingRetryCallback.java index 1b57e4ef33..41bc619726 100644 --- a/clientlibs/java/src/main/java/org/upgradeplatform/utils/PublishingRetryCallback.java +++ b/clientlibs/java/src/main/java/org/upgradeplatform/utils/PublishingRetryCallback.java @@ -7,6 +7,7 @@ import javax.ws.rs.core.Response; import static javax.ws.rs.core.Response.Status.Family.SUCCESSFUL; +import static javax.ws.rs.core.Response.Status.Family.CLIENT_ERROR; public class PublishingRetryCallback implements InvocationCallback { @@ -35,7 +36,10 @@ public PublishingRetryCallback(AsyncInvoker invoker, Entity message, int retr @Override public void completed(Response response) { - if (SUCCESSFUL.equals(response.getStatusInfo().getFamily()) || retries <= 0) { + boolean isSuccess = SUCCESSFUL.equals(response.getStatusInfo().getFamily()); + boolean isClientRequestError = CLIENT_ERROR.equals(response.getStatusInfo().getFamily()); + + if (isSuccess || isClientRequestError || retries <= 0) { callback.completed(response); } else { retry(); diff --git a/clientlibs/java/src/main/java/org/upgradeplatform/utils/Utils.java b/clientlibs/java/src/main/java/org/upgradeplatform/utils/Utils.java index e96a7e8b6f..4ac3b0c6f4 100644 --- a/clientlibs/java/src/main/java/org/upgradeplatform/utils/Utils.java +++ b/clientlibs/java/src/main/java/org/upgradeplatform/utils/Utils.java @@ -33,7 +33,7 @@ public class Utils public static final String PATCH = "PATCH"; - public static final int MAX_RETRIES = 3; + public static final int MAX_RETRIES = 1; public static enum RequestType {