You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2022/09/30 00:33:33 UTC
[cxf] branch main updated: CXF-8712: One-off issue with retries (fixing the test cases)
This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/main by this push:
new 4ef3909bc3 CXF-8712: One-off issue with retries (fixing the test cases)
4ef3909bc3 is described below
commit 4ef3909bc37cc1a0b6b8619a6db76b1308a56e07
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Thu Sep 29 20:32:41 2022 -0400
CXF-8712: One-off issue with retries (fixing the test cases)
---
.../src/main/java/org/apache/cxf/clustering/RetryStrategy.java | 2 +-
.../org/apache/cxf/systest/jaxrs/failover/AbstractFailoverTest.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java b/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java
index e8e3ec235a..8e823bb7ce 100644
--- a/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java
+++ b/rt/features/clustering/src/main/java/org/apache/cxf/clustering/RetryStrategy.java
@@ -44,7 +44,7 @@ public class RetryStrategy extends SequentialStrategy {
@Override
protected <T> T getNextAlternate(List<T> alternates) {
// is the amount of retries for the first alternate already exceeded?
- if (!stillTheSameAddress()) {
+ if (!stillTheSameAddress() && !alternates.isEmpty()) {
alternates.remove(0);
}
return alternates.isEmpty() ? null : alternates.get(0);
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/AbstractFailoverTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/AbstractFailoverTest.java
index 9ee204f059..b5b323a157 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/AbstractFailoverTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/AbstractFailoverTest.java
@@ -376,7 +376,7 @@ public abstract class AbstractFailoverTest extends AbstractBusClientServerTestBa
String address = (String)next;
Integer count = map.get(address);
if (count == null) {
- count = 0;
+ count = map.isEmpty() ? 1 /* count first call */ : 0;
}
count++;
map.put(address, count);
@@ -389,7 +389,7 @@ public abstract class AbstractFailoverTest extends AbstractBusClientServerTestBa
}
public int getAddressCount(String address) {
- return map.get(address);
+ return map.get(address) - 1;
}
}
}