[jboss-cvs] JBossCache/src/org/jboss/cache/buddyreplication ...
Manik Surtani
manik at jboss.org
Mon Mar 12 14:13:48 EDT 2007
User: msurtani
Date: 07/03/12 14:13:48
Modified: src/org/jboss/cache/buddyreplication BuddyManager.java
Log:
JBCACHE-1005
Revision Changes Path
1.65 +29 -13 JBossCache/src/org/jboss/cache/buddyreplication/BuddyManager.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BuddyManager.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/BuddyManager.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- BuddyManager.java 6 Feb 2007 19:29:38 -0000 1.64
+++ BuddyManager.java 12 Mar 2007 18:13:48 -0000 1.65
@@ -13,7 +13,6 @@
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.Region;
-import org.jboss.cache.util.ExposedByteArrayOutputStream;
import org.jboss.cache.config.BuddyReplicationConfig;
import org.jboss.cache.config.BuddyReplicationConfig.BuddyLocatorConfig;
import org.jboss.cache.lock.TimeoutException;
@@ -21,6 +20,7 @@
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
import org.jboss.cache.statetransfer.StateTransferManager;
+import org.jboss.cache.util.ExposedByteArrayOutputStream;
import org.jboss.util.stream.MarshalledValueInputStream;
import org.jboss.util.stream.MarshalledValueOutputStream;
import org.jgroups.Address;
@@ -186,7 +186,7 @@
return s.replace(':', '_');
}
- public void init(CacheImpl cache) throws Exception
+ public void init(CacheImpl cache) throws CacheException
{
log.debug("Starting buddy manager");
this.cache = cache;
@@ -287,7 +287,7 @@
* have been added. Makes use of the BuddyLocator and then
* makes RPC calls to remote nodes to assign/remove buddies.
*/
- private void reassignBuddies(List<Address> membership) throws Exception
+ private void reassignBuddies(List<Address> membership) throws CacheException
{
if (log.isDebugEnabled())
{
@@ -326,7 +326,7 @@
}
if (!uninitialisedBuddies.isEmpty())
{
- addBuddies(uninitialisedBuddies);
+ addBuddies(newBuddies);
}
else
{
@@ -516,7 +516,7 @@
// -------------- internal helpers methods --------------------
- private void removeFromGroup(List<Address> buddies) throws InterruptedException
+ private void removeFromGroup(List<Address> buddies)
{
if (log.isDebugEnabled())
{
@@ -544,8 +544,16 @@
if (attemptsLeft > 0)
{
log.info("One of the buddies have not been initialised. Will retry after a short nap.");
+ try
+ {
Thread.sleep(UNINIT_BUDDIES_RETRY_NAPTIME[currentAttempt++]);
}
+ catch (InterruptedException e1)
+ {
+ // what do we do?
+ log.trace("Thread interrupted while sleeping/waiting for a retry", e1);
+ }
+ }
else
{
throw new BuddyNotInitException("Unable to contact buddy after " + UNINIT_BUDDIES_RETRIES + " retries");
@@ -560,7 +568,7 @@
log.trace("removeFromGroup notification complete");
}
- private void addBuddies(List<Address> buddies) throws Exception
+ private void addBuddies(List<Address> buddies) throws CacheException
{
// this check is redundant - if buddies is empty this method will not be called. - Manik
@@ -635,7 +643,15 @@
if (attemptsLeft > 0)
{
log.info("One of the buddies have not been initialised. Will retry after a short nap.");
+ try
+ {
Thread.sleep(UNINIT_BUDDIES_RETRY_NAPTIME[currentAttempt++]);
+ }
+ catch (InterruptedException e1)
+ {
+ // what do we do?
+ log.trace("Thread interrupted while sleeping/waiting for a retry", e1);
+ }
}
else
@@ -653,7 +669,7 @@
log.trace("addToGroup notification complete");
}
- private byte[] acquireState(Fqn fqn) throws Exception
+ private byte[] acquireState(Fqn fqn) throws CacheException
{
// Call _getState with progressively longer timeouts until we
// get state or it doesn't throw a TimeoutException
@@ -687,7 +703,7 @@
}
catch (Exception e)
{
- throw e;
+ throw new CacheException("Error acquiring state", e);
}
catch (Throwable t)
{
@@ -867,7 +883,7 @@
{
if (!isBackupFqn(fqn)) return fqn;
// remove the first 2 elements
- return fqn.getFqnChild(2, fqn.size());
+ return fqn.getSubFqn(2, fqn.size());
}
More information about the jboss-cvs-commits
mailing list