Author: manik.surtani(a)jboss.com
Date: 2009-03-03 12:07:33 -0500 (Tue, 03 Mar 2009)
New Revision: 7832
Modified:
core/branches/flat/src/main/java/org/horizon/remoting/RPCManagerImpl.java
Log:
Better waits between attempts
Modified: core/branches/flat/src/main/java/org/horizon/remoting/RPCManagerImpl.java
===================================================================
--- core/branches/flat/src/main/java/org/horizon/remoting/RPCManagerImpl.java 2009-03-03
17:02:14 UTC (rev 7831)
+++ core/branches/flat/src/main/java/org/horizon/remoting/RPCManagerImpl.java 2009-03-03
17:07:33 UTC (rev 7832)
@@ -73,6 +73,10 @@
}
public void retrieveState(String cacheName, long timeout) throws
StateTransferException {
+ // TODO make these configurable
+ int initialWaitTime = 1000; // millis
+ int waitTimeIncreaseFactor = 2;
+ int numRetries = 3;
List<Address> members = t.getMembers();
if (members.size() < 2) {
if (log.isDebugEnabled())
@@ -85,7 +89,7 @@
try {
outer:
- for (int i = 0, wait = 1000; i < 5; i++) {
+ for (int i = 0, wait = initialWaitTime; i < numRetries; i++) {
for (Address member : members) {
if (!member.equals(t.getAddress())) {
try {
@@ -108,7 +112,7 @@
log.warn("Could not find available peer for state, backing off
and retrying");
try {
- Thread.sleep(wait <<= 2);
+ Thread.sleep(wait *= waitTimeIncreaseFactor);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
Show replies by date