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

Manik Surtani msurtani at jboss.com
Wed Oct 11 07:53:40 EDT 2006


  User: msurtani
  Date: 06/10/11 07:53:40

  Modified:    src/org/jboss/cache/buddyreplication   BuddyLocator.java
                        NextMemberBuddyLocator.java
  Log:
  Updated javadocs, and genericized
  
  Revision  Changes    Path
  1.3       +23 -23    JBossCache/src/org/jboss/cache/buddyreplication/BuddyLocator.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BuddyLocator.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/BuddyLocator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- BuddyLocator.java	10 Oct 2006 19:04:13 -0000	1.2
  +++ BuddyLocator.java	11 Oct 2006 11:53:39 -0000	1.3
  @@ -14,8 +14,8 @@
   
   /**
    * Buddy Locators help the {@see BuddyManager} select buddies for its buddy group.
  - * <p>
  - * Implementations of this class must declard a public no-arguments constructor.
  + * <p/>
  + * Implementations of this class must declare a public no-arguments constructor.
    * </p>
    *
    * @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
  @@ -38,13 +38,13 @@
        *                      the "buddy pool" they have identified themselves as 
        *                      belonging too.  A BuddyLocator implementation can use
        *                      this information to preferentially assign buddies from
  -     *                      the same buddy pool as <code>dataOwner</code>.
  +    *                          the same buddy pool as <code>dataOwner</code>.  May be
  +    *                          <code>null</code> if buddy pools aren't configured.
        * @param currentMembership List<IpAddress> of the current cluster members
        * @param dataOwner IpAddress of the node for which buddies should be selected
  -     * 
        * @return List<IpAddress> of the nodes that should serve as buddies for
        *         <code>dataOwner</code>. Will not be <code>null</code>, may
        *         be empty.
        */
  -    public List locateBuddies(Map buddyPoolMap, List currentMembership, IpAddress dataOwner);
  +   public List<IpAddress> locateBuddies(Map<IpAddress, String> buddyPoolMap, List<IpAddress> currentMembership, IpAddress dataOwner);
   }
  
  
  
  1.5       +123 -120  JBossCache/src/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NextMemberBuddyLocator.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/buddyreplication/NextMemberBuddyLocator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- NextMemberBuddyLocator.java	9 Aug 2006 14:49:59 -0000	1.4
  +++ NextMemberBuddyLocator.java	11 Oct 2006 11:53:39 -0000	1.5
  @@ -49,15 +49,15 @@
               if (numBuddiesStr != null) numBuddies = Integer.parseInt(numBuddiesStr);
               if (ignoreColocatedBuddiesStr != null)
               {
  -                ignoreColocatedBuddies = Boolean.valueOf(ignoreColocatedBuddiesStr).booleanValue();
  +            ignoreColocatedBuddies = Boolean.valueOf(ignoreColocatedBuddiesStr);
               }
           }
       }
   
  -    public List locateBuddies(Map buddyPoolMap, List currentMembership, IpAddress dataOwner)
  +   public List<IpAddress> locateBuddies(Map<IpAddress, String> buddyPoolMap, List<IpAddress> currentMembership, IpAddress dataOwner)
       {
           int numBuddiesToFind = Math.min(numBuddies, currentMembership.size());
  -        List buddies = new ArrayList(numBuddiesToFind);
  +      List<IpAddress> buddies = new ArrayList<IpAddress>(numBuddiesToFind);
   
           // find where we are in the list.
           int dataOwnerSubscript = currentMembership.indexOf(dataOwner);
  @@ -77,7 +77,8 @@
               {
                   ignoreColocatedBuddiesForSession = false;
                   i = 0;
  -                if (log.isInfoEnabled()) log.info("Expected to look for " + numBuddiesToFind + " buddies but could only find " + buddies.size() + " suitable candidates - trying with colocated buddies as well.");
  +            if (log.isInfoEnabled())
  +               log.info("Expected to look for " + numBuddiesToFind + " buddies but could only find " + buddies.size() + " suitable candidates - trying with colocated buddies as well.");
   
                   continue;
               }
  @@ -88,7 +89,8 @@
                   buddyPoolMap = null;
                   ignoreColocatedBuddiesForSession = ignoreColocatedBuddies; // reset this flag
                   i = 0;
  -                if (log.isInfoEnabled()) log.info("Expected to look for " + numBuddiesToFind + " buddies but could only find " + buddies.size() + " suitable candidates - trying again, ignoring buddy pool hints.");
  +            if (log.isInfoEnabled())
  +               log.info("Expected to look for " + numBuddiesToFind + " buddies but could only find " + buddies.size() + " suitable candidates - trying again, ignoring buddy pool hints.");
                   continue;
               }
   
  @@ -96,11 +98,12 @@
               // completely and still havent found any more suitable candidates.  Give up with however many we have.
               if (subscript >= currentMembership.size())
               {
  -                if (log.isInfoEnabled()) log.info("Expected to look for " + numBuddiesToFind + " buddies but could only find " + buddies.size() + " suitable candidates!");
  +            if (log.isInfoEnabled())
  +               log.info("Expected to look for " + numBuddiesToFind + " buddies but could only find " + buddies.size() + " suitable candidates!");
                   break;
               }
   
  -            IpAddress candidate = (IpAddress) currentMembership.get(subscript);
  +         IpAddress candidate = currentMembership.get(subscript);
               if (
                       !candidate.equals(dataOwner) && // ignore self from selection as buddy
                               !buddies.contains(candidate) && // havent already considered this candidate
  
  
  



More information about the jboss-cvs-commits mailing list