You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by GitBox <gi...@apache.org> on 2022/06/08 22:35:00 UTC

[GitHub] [cxf] reta commented on a diff in pull request #954: CXF-8712 One-off issue with retries

reta commented on code in PR #954:
URL: https://github.com/apache/cxf/pull/954#discussion_r892918144


##########
rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java:
##########
@@ -42,7 +42,11 @@ public List<Endpoint> getAlternateEndpoints(Exchange exchange) {
     }
 
     protected <T> T getNextAlternate(List<T> alternates) {
-        return stillTheSameAddress() ? alternates.get(0) : alternates.remove(0);
+        // is the amount of retries for the first alternate already exceeded?
+        if (!stillTheSameAddress()) {
+            alternates.remove(0);
+        }
+        return alternates.isEmpty() ? null : alternates.get(0);

Review Comment:
   This is dangerous one, `getNextAlternate()` is not supposed to return `null` and is calling for trouble [1], we should accommodate that.
   
   [1] https://github.com/apache/cxf/blob/master/rt/features/clustering/src/main/java/org/apache/cxf/clustering/AbstractStaticFailoverStrategy.java#L113



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@cxf.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org