You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2011/08/08 12:06:38 UTC
svn commit: r1154898 - in /cxf/branches/2.4.x-fixes: ./
rt/core/src/main/java/org/apache/cxf/clustering/AbstractStaticFailoverStrategy.java
rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
Author: sergeyb
Date: Mon Aug 8 10:06:37 2011
New Revision: 1154898
URL: http://svn.apache.org/viewvc?rev=1154898&view=rev
Log:
Merged revisions 1154896 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1154896 | sergeyb | 2011-08-08 10:53:48 +0100 (Mon, 08 Aug 2011) | 1 line
[CXF-3596] Updating FailoverTargetSelector to check strategy specific delays between retries
........
Modified:
cxf/branches/2.4.x-fixes/ (props changed)
cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/AbstractStaticFailoverStrategy.java
cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 8 10:06:37 2011
@@ -1 +1 @@
-/cxf/trunk:1154143,1154149,1154158,1154229,1154232,1154466,1154870
+/cxf/trunk:1154143,1154149,1154158,1154229,1154232,1154466,1154870,1154896
Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/AbstractStaticFailoverStrategy.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/AbstractStaticFailoverStrategy.java?rev=1154898&r1=1154897&r2=1154898&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/AbstractStaticFailoverStrategy.java (original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/AbstractStaticFailoverStrategy.java Mon Aug 8 10:06:37 2011
@@ -42,8 +42,16 @@ public abstract class AbstractStaticFail
LogUtils.getL7dLogger(AbstractStaticFailoverStrategy.class);
private List<String> alternateAddresses;
+ private long delayBetweenRetries;
-
+ public void setDelayBetweenRetries(long delay) {
+ this.delayBetweenRetries = delay;
+ }
+
+ public long getDelayBetweenRetries() {
+ return this.delayBetweenRetries;
+ }
+
public void setAlternateAddresses(List<String> alternateAddresses) {
this.alternateAddresses = alternateAddresses;
}
Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java?rev=1154898&r1=1154897&r2=1154898&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java (original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/clustering/FailoverTargetSelector.java Mon Aug 8 10:06:37 2011
@@ -132,6 +132,10 @@ public class FailoverTargetSelector exte
if (retry != null) {
try {
failover = true;
+ long delay = getDelayBetweenRetries();
+ if (delay > 0) {
+ Thread.sleep(delay);
+ }
retry.invoke(invocation.getBindingOperationInfo(),
invocation.getParams(),
invocation.getContext(),
@@ -188,6 +192,19 @@ public class FailoverTargetSelector exte
}
/**
+ * Returns delay (in milliseconds) between retries
+ * @return delay, 0 means no delay
+ */
+ protected long getDelayBetweenRetries() {
+ FailoverStrategy strategy = getStrategy();
+ if (strategy instanceof AbstractStaticFailoverStrategy) {
+ return ((AbstractStaticFailoverStrategy)strategy).getDelayBetweenRetries();
+ }
+ //perhaps supporting FailoverTargetSelector specific property can make sense too
+ return 0;
+ }
+
+ /**
* Check if the exchange is suitable for a failover.
*
* @param exchange the current Exchange