[jboss-cvs] JBossAS SVN: r69268 - trunk/cluster/src/main/org/jboss/ha/framework/server.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 24 04:43:32 EST 2008


Author: galder.zamarreno at jboss.com
Date: 2008-01-24 04:43:32 -0500 (Thu, 24 Jan 2008)
New Revision: 69268

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
Log:
[JBAS-5155] Implementation for lookupReplicantsNodes() added and made lookupReplicantsNodeNames() call the newly created method.

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2008-01-24 06:33:37 UTC (rev 69267)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2008-01-24 09:43:32 UTC (rev 69268)
@@ -52,6 +52,7 @@
  * @author  <a href="mailto:bill at burkecentral.com">Bill Burke</a>.
  * @author  <a href="mailto:sacha.labourey at cogito-info.ch">Sacha Labourey</a>.
  * @author  Scott.stark at jboss.org
+ * @author  <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
  * @version $Revision$
  */
 public class DistributedReplicantManagerImpl
@@ -469,21 +470,37 @@
    
    public List lookupReplicantsNodeNames(String key)
    {      
+      List<ClusterNode> nodes = lookupReplicantsNodes(key);
+      if (nodes == null)
+      {
+         return null;
+      }
+      
+      List<String> nodeNames = new ArrayList<String>(nodes.size());
+      for (ClusterNode node : nodes)
+      {
+         nodeNames.add(node.getName());
+      }  
+      
+      return nodeNames;
+   }
+
+   public List<ClusterNode> lookupReplicantsNodes(String key)
+   {
       boolean locallyReplicated = localReplicants.containsKey (key);
       Map replicant = (Map)replicants.get(key);
       if (replicant == null && !locallyReplicated)
          return null;
 
-      ArrayList rtn = new ArrayList();
+      List<ClusterNode> rtn = new ArrayList<ClusterNode>();
       
       if (replicant == null)
       {   
          if (locallyReplicated)
-            rtn.add(this.nodeName);
+            rtn.add(partition.getClusterNode());
       }
       else
       {
-         // JBAS-2677. Put the replicants in view order.
          Set keys = replicant.keySet();
          ClusterNode[] nodes = partition.getClusterNodes();
          String keyOwner;
@@ -492,17 +509,17 @@
             keyOwner = nodes[i].getName();
             if (locallyReplicated && nodeName.equals(keyOwner))
             {
-               rtn.add(this.nodeName);
+               rtn.add(partition.getClusterNode());
                continue;
             }
             
             if (keys.contains(keyOwner))
-               rtn.add(keyOwner);            
+               rtn.add(nodes[i]);            
          }
       }
       
       return rtn;
-   }
+   }   
    
    public void registerListener(String key, DistributedReplicantManager.ReplicantListener subscriber)
    {




More information about the jboss-cvs-commits mailing list