This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch ranger-2.7
in repository https://gitbox.apache.org/repos/asf/ranger.git


The following commit(s) were added to refs/heads/ranger-2.7 by this push:
     new 20882cd40 RANGER-5201: Retry GET request on server error in 
RangerRESTClient (#565)
20882cd40 is described below

commit 20882cd40995412a3cf846f2ea077a0ab6123f18
Author: Naoki Takezoe <[email protected]>
AuthorDate: Sat Apr 26 08:58:35 2025 +0900

    RANGER-5201: Retry GET request on server error in RangerRESTClient (#565)
    
    (cherry picked from commit 8d20a4458002c2a0675f8e7de4694bedda391fed)
---
 .../java/org/apache/ranger/plugin/util/RangerRESTClient.java     | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git 
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java
 
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java
index e5461c2e6..cb131d97d 100644
--- 
a/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java
+++ 
b/agents-common/src/main/java/org/apache/ranger/plugin/util/RangerRESTClient.java
@@ -44,6 +44,7 @@
 import javax.net.ssl.TrustManager;
 import javax.net.ssl.TrustManagerFactory;
 import javax.ws.rs.core.Cookie;
+import javax.ws.rs.core.Response;
 
 import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 import com.sun.jersey.api.client.filter.ClientFilter;
@@ -516,6 +517,10 @@ public ClientResponse get(String relativeUrl, Map<String, 
String> params) throws
                                finalResponse = 
webResource.accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE).type(RangerRESTUtils.REST_MIME_TYPE_JSON).get(ClientResponse.class);
 
                                if (finalResponse != null) {
+                                       if 
(finalResponse.getStatusInfo().getFamily() == 
Response.Status.Family.SERVER_ERROR) {
+                                               throw new 
ClientHandlerException("Response status: " + finalResponse.getStatus());
+                                       }
+
                                        
setLastKnownActiveUrlIndex(currentIndex);
                                        break;
                                }
@@ -544,6 +549,10 @@ public ClientResponse get(String relativeUrl, Map<String, 
String> params, Cookie
                                finalResponse = 
br.accept(RangerRESTUtils.REST_EXPECTED_MIME_TYPE).type(RangerRESTUtils.REST_MIME_TYPE_JSON).get(ClientResponse.class);
 
                                if (finalResponse != null) {
+                                       if 
(finalResponse.getStatusInfo().getFamily() == 
Response.Status.Family.SERVER_ERROR) {
+                                               throw new 
ClientHandlerException("Response status: " + finalResponse.getStatus());
+                                       }
+
                                        
setLastKnownActiveUrlIndex(currentIndex);
                                        break;
                                }

Reply via email to