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:06 UTC
[cxf] branch 3.6.x-fixes 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 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/3.6.x-fixes by this push:
new 03e0b65493 CXF-8712: One-off issue with retries (fixing the test cases)
03e0b65493 is described below
commit 03e0b6549334173feb73d3d96477d72f9378d8c5
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 e5ffb25ce4..8c1c3cd9b4 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
@@ -377,7 +377,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);
@@ -390,7 +390,7 @@ public abstract class AbstractFailoverTest extends AbstractBusClientServerTestBa
}
public int getAddressCount(String address) {
- return map.get(address);
+ return map.get(address) - 1;
}
}
}