[jboss-cvs] JBossCache/src/org/jboss/cache/buddyreplication ...

Manik Surtani msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 13:08:18 EDT 2006


  User: msurtani
  Date: 06/08/30 13:08:18

  Modified:    src/org/jboss/cache/buddyreplication  BuddyManager.java
  Log:
  Java5 optimisations
  
  Revision  Changes    Path
  1.43      +730 -724  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.42
  retrieving revision 1.43
  diff -u -b -r1.42 -r1.43
  --- BuddyManager.java	25 Aug 2006 14:10:07 -0000	1.42
  +++ BuddyManager.java	30 Aug 2006 17:08:18 -0000	1.43
  @@ -16,6 +16,7 @@
   import org.jboss.cache.Fqn;
   import org.jboss.cache.TreeCache;
   import org.jboss.cache.lock.TimeoutException;
  +import org.jboss.cache.marshall.MethodCall;
   import org.jboss.cache.marshall.MethodCallFactory;
   import org.jboss.cache.marshall.MethodDeclarations;
   import org.jboss.cache.marshall.Region;
  @@ -25,7 +26,6 @@
   import org.jboss.cache.xml.XmlHelper;
   import org.jgroups.Address;
   import org.jgroups.View;
  -import org.jboss.cache.marshall.MethodCall;
   import org.jgroups.stack.IpAddress;
   import org.w3c.dom.Element;
   
  @@ -131,7 +131,8 @@
           }
           finally
           {
  -            if (log.isDebugEnabled()) log.debug("Using buddy communication timeout of " + buddyCommunicationTimeout + " millis");
  +         if (log.isDebugEnabled())
  +            log.debug("Using buddy communication timeout of " + buddyCommunicationTimeout + " millis");
           }
           buddyPoolName = XmlHelper.readStringContents(element, "buddyPoolName");
           if (buddyPoolName != null && buddyPoolName.equals("")) buddyPoolName = null;
  @@ -403,7 +404,7 @@
           
           StateTransferManager stateMgr = cache.getStateTransferManager();
   
  -        for (Iterator it = state.entrySet().iterator(); it.hasNext(); )
  +      for (Iterator it = state.entrySet().iterator(); it.hasNext();)
           {
              Map.Entry entry = (Map.Entry) it.next();
              Fqn fqn = (Fqn) entry.getKey();
  @@ -471,6 +472,7 @@
       {
           return transformFqns(call, call.getMethodId() != MethodDeclarations.dataGravitationCleanupMethod_id);
       }
  +
       public MethodCall transformFqns(MethodCall call, boolean transformForCurrentCall)
       {
           if (call != null && call.getArgs() != null)
  @@ -489,11 +491,12 @@
   
       private void removeFromGroup(List buddies)
       {
  -        if (log.isDebugEnabled()) log.debug("Removing obsolete buddies from buddy group [" + buddyGroup.getGroupName() + "].  Obsolete buddies are " + buddies);
  +      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, new Object[]{buddyGroup.getGroupName()});
  -        MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, new Object[]{membershipCall});
  +      MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteRemoveFromBuddyGroupMethod, buddyGroup.getGroupName());
  +      MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, membershipCall);
   
           try
           {
  @@ -514,7 +517,8 @@
   //          return;
   
   
  -        if (log.isDebugEnabled()) log.debug("Assigning new buddies to buddy group [" + buddyGroup.getGroupName() + "].  New buddies are " + buddies);
  +      if (log.isDebugEnabled())
  +         log.debug("Assigning new buddies to buddy group [" + buddyGroup.getGroupName() + "].  New buddies are " + buddies);
   
   
           buddyGroup.buddies.addAll(buddies);
  @@ -559,8 +563,8 @@
           }
   
           // now broadcast a message to the newly assigned buddies.
  -        MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAssignToBuddyGroupMethod, new Object[]{buddyGroup, stateMap});
  -        MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, new Object[]{membershipCall});
  +      MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAssignToBuddyGroupMethod, buddyGroup, stateMap);
  +      MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, membershipCall);
   
           try
           {
  @@ -642,10 +646,11 @@
       private void broadcastBuddyPoolMembership(List recipients)
       {
           // broadcast to other caches
  -        if (log.isDebugEnabled()) log.debug("Instance " + buddyGroup.getDataOwner() + " broadcasting membership in buddy pool " + buddyPoolName + " to recipients " + recipients);
  +      if (log.isDebugEnabled())
  +         log.debug("Instance " + buddyGroup.getDataOwner() + " broadcasting membership in buddy pool " + buddyPoolName + " to recipients " + recipients);
   
  -        MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod, new Object[]{buddyGroup.getDataOwner(), buddyPoolName});
  -        MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, new Object[]{membershipCall});
  +      MethodCall membershipCall = MethodCallFactory.create(MethodDeclarations.remoteAnnounceBuddyPoolNameMethod, buddyGroup.getDataOwner(), buddyPoolName);
  +      MethodCall replicateCall = MethodCallFactory.create(MethodDeclarations.replicateMethod, membershipCall);
   
           try
           {
  @@ -715,6 +720,7 @@
   
       /**
        * Assumes the backup Fqn if the current instance is the data owner
  +    *
        * @param originalFqn
        * @return backup fqn
        */
  
  
  



More information about the jboss-cvs-commits mailing list