[jboss-cvs] JBossCache/src/org/jboss/cache/buddyreplication ...
Manik Surtani
msurtani at jboss.com
Thu Jan 4 00:35:40 EST 2007
User: msurtani
Date: 07/01/04 00:35:40
Modified: src/org/jboss/cache/buddyreplication BuddyManager.java
Log:
Major changes around nodes, and the way they interact with the interceptor stack.
Also removed redundant methods in NodeSPI and removed the need for casting to NodeSPI in most cases.
Revision Changes Path
1.58 +22 -8 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.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- BuddyManager.java 30 Dec 2006 19:48:45 -0000 1.57
+++ BuddyManager.java 4 Jan 2007 05:35:40 -0000 1.58
@@ -123,7 +123,7 @@
* Flag to prevent us receiving and processing remote calls before we've started
*/
private boolean initialised = false;
-// private Latch initLatch = new Latch();
+ // private Latch initLatch = new Latch();
public BuddyManager(BuddyReplicationConfig config)
{
@@ -144,8 +144,10 @@
// Update the overall config with the BuddyLocatorConfig actually used
if (blc != buddyLocator.getConfig())
+ {
config.setBuddyLocatorConfig(buddyLocator.getConfig());
}
+ }
public BuddyReplicationConfig getConfig()
{
@@ -187,7 +189,7 @@
log.debug("Starting buddy manager");
this.cache = cache;
buddyGroup = new BuddyGroup();
- buddyGroup.setDataOwner((Address) cache.getLocalAddress());
+ buddyGroup.setDataOwner(cache.getLocalAddress());
buddyGroup.setGroupName(getGroupNameFromAddress(cache.getLocalAddress()));
if (config.getBuddyPoolName() != null)
@@ -345,7 +347,9 @@
log.debug(buddyGroup.getDataOwner() + ": received announcement that cache instance " + address + " is in buddy pool " + poolName);
}
if (poolName != null)
+ {
buddyPool.put(address, poolName);
+ }
else
{
synchronized (nullBuddyPool)
@@ -518,7 +522,9 @@
private void removeFromGroup(List<Address> buddies) throws InterruptedException
{
if (log.isDebugEnabled())
+ {
log.debug("Removing obsolete buddies from buddy group [" + buddyGroup.getGroupName() + "]. Obsolete buddies are " + buddies);
+ }
buddyGroup.buddies.removeAll(buddies);
// now broadcast a message to the removed buddies.
MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteRemoveFromBuddyGroupMethod, buddyGroup.getGroupName());
@@ -561,12 +567,14 @@
{
// this check is redundant - if buddies is empty this method will not be called. - Manik
-// if (buddies.size() == 0)
-// return;
+ // if (buddies.size() == 0)
+ // return;
if (log.isDebugEnabled())
+ {
log.debug("Assigning new buddies to buddy group [" + buddyGroup.getGroupName() + "]. New buddies are " + buddies);
+ }
buddyGroup.buddies.addAll(buddies);
@@ -718,7 +726,9 @@
{
// broadcast to other caches
if (log.isDebugEnabled())
+ {
log.debug("Instance " + buddyGroup.getDataOwner() + " broadcasting membership in buddy pool " + config.getBuddyPoolName() + " to recipients " + recipients);
+ }
MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod, buddyGroup.getDataOwner(), config.getBuddyPoolName());
MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, membershipCall);
@@ -901,7 +911,9 @@
{
log.trace("Broadcasting pool membership details, triggered by view change.");
if (members.oldMembers == null)
+ {
broadcastBuddyPoolMembership();
+ }
else
{
List<Address> delta = new ArrayList<Address>();
@@ -919,16 +931,18 @@
// make sure no one is concurrently writing to nullBuddyPool.
synchronized (nullBuddyPool)
{
-// log.trace("Testing on node " + buddyGroup.getDataOwner() + " for candidate " + address);
-// log.trace("Is me? " + address.equals(cache.getLocalAddress()));
-// log.trace("is in bP? " + buddyPool.keySet().contains(address));
-// log.trace("is in nBP? " + nullBuddyPool.contains(address));
+ // log.trace("Testing on node " + buddyGroup.getDataOwner() + " for candidate " + address);
+ // log.trace("Is me? " + address.equals(cache.getLocalAddress()));
+ // log.trace("is in bP? " + buddyPool.keySet().contains(address));
+ // log.trace("is in nBP? " + nullBuddyPool.contains(address));
infoReceived = infoReceived && (address.equals(cache.getLocalAddress()) || buddyPool.keySet().contains(address) || nullBuddyPool.contains(address));
}
}
if (log.isTraceEnabled())
+ {
log.trace(buddyGroup.getDataOwner() + " received buddy pool info for new members " + newMembers + "? " + infoReceived);
+ }
return infoReceived;
}
More information about the jboss-cvs-commits
mailing list