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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 14 16:03:58 EST 2007


Author: jerrygauth
Date: 2007-02-14 16:03:58 -0500 (Wed, 14 Feb 2007)
New Revision: 60551

Modified:
   trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
Log:
JBAS-2440, replace HashMap type declaration with Map in DistributedReplicantManagerImpl

Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2007-02-14 19:26:35 UTC (rev 60550)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java	2007-02-14 21:03:58 UTC (rev 60551)
@@ -67,10 +67,10 @@
    // Attributes ----------------------------------------------------
    protected static int threadID;
    
-   protected ConcurrentReaderHashMap localReplicants = new ConcurrentReaderHashMap();
-   protected ConcurrentReaderHashMap replicants = new ConcurrentReaderHashMap();
-   protected ConcurrentReaderHashMap keyListeners = new ConcurrentReaderHashMap();
-   protected HashMap intraviewIdCache = new HashMap();
+   protected Map localReplicants = new ConcurrentReaderHashMap();
+   protected Map replicants = new ConcurrentReaderHashMap();
+   protected Map keyListeners = new ConcurrentReaderHashMap();
+   protected Map intraviewIdCache = new HashMap();
    protected HAPartition partition; 
    /** The handler used to send replicant change notifications asynchronously */
    protected AsynchEventHandler asynchHandler;  
@@ -212,7 +212,7 @@
       while (catsIter.hasNext ())
       {
          String category = (String)catsIter.next ();
-         HashMap content = (HashMap)this.replicants.get (category);
+         Map content = (Map)this.replicants.get (category);
          if (content == null)
             content = new HashMap ();
          java.util.Iterator keysIter = content.keySet ().iterator ();
@@ -254,7 +254,7 @@
       while (catsIter.hasNext ())
       {
          String category = (String)catsIter.next ();
-         HashMap content = (HashMap)this.replicants.get (category);
+         Map content = (Map)this.replicants.get (category);
          if (content == null)
             content = new HashMap ();
          java.util.Iterator keysIter = content.keySet ().iterator ();
@@ -299,11 +299,15 @@
       while (catsIter.hasNext ())
       {
          String category = (String)catsIter.next ();
-         HashMap content = (HashMap)this.replicants.get (category);
+         Map content = (Map)this.replicants.get (category);
          if (content == null)
-            content = new HashMap ();
+            content = new HashMap();
          else
-            content = (HashMap)content.clone ();
+         {
+            Map temp = new HashMap();
+            temp.putAll(content);
+            content = temp;
+         }
          
          Serializable local = lookupLocalReplicant(category);
          if (local != null)
@@ -321,10 +325,9 @@
    public void setCurrentState(Serializable newState)
    {
       Object[] globalState = (Object[])newState;
-      
-      HashMap map = (HashMap)globalState[0];
+      Map map = (Map)globalState[0];
       this.replicants.putAll(map);
-      this.intraviewIdCache = (HashMap)globalState[1];
+      this.intraviewIdCache = (Map)globalState[1];
 
       if( trace )
       {
@@ -438,7 +441,7 @@
    public List lookupReplicants(String key)
    {
       Serializable local = lookupLocalReplicant(key);
-      HashMap replicant = (HashMap)replicants.get(key);
+      Map replicant = (Map)replicants.get(key);
       if (replicant == null && local == null)
          return null;
 
@@ -476,7 +479,7 @@
    public List lookupReplicantsNodeNames(String key)
    {      
       boolean locallyReplicated = localReplicants.containsKey (key);
-      HashMap replicant = (HashMap)replicants.get(key);
+      Map replicant = (Map)replicants.get(key);
       if (replicant == null && !locallyReplicated)
          return null;
 
@@ -562,7 +565,7 @@
       }
 
       Vector allNodes = this.partition.getCurrentView ();
-      HashMap repForKey = (HashMap)replicants.get(key);
+      Map repForKey = (Map)replicants.get(key);
       if (repForKey==null)
       {
          if( trace )
@@ -648,7 +651,7 @@
    {
       synchronized(replicants)
       {
-         HashMap replicant = (HashMap)replicants.get(key);
+         Map replicant = (Map)replicants.get(key);
          if (replicant == null) return false;
          Object removed = replicant.remove(nodeName);
          if (removed != null)
@@ -747,7 +750,7 @@
    {
       synchronized(map)
       {
-         HashMap rep = (HashMap)map.get(key);
+         Map rep = (Map)map.get(key);
          if (rep == null)
          {
             if( trace )
@@ -768,7 +771,7 @@
          while (keysIter.hasNext ())
          {
             String key = (String)keysIter.next ();
-            HashMap values = (HashMap)replicants.get (key);
+            Map values = (Map)replicants.get (key);
             if ( (values != null) && values.containsKey (nodeName) )
             {
                result.add (key);
@@ -794,7 +797,7 @@
     */   
    protected boolean replicantEntryAlreadyExists (Map map, String key, String nodeName)
    {
-         HashMap rep = (HashMap)map.get(key);
+         Map rep = (Map)map.get(key);
          if (rep == null)
             return false;
          else
@@ -848,7 +851,7 @@
          if( trace )
             log.trace("Start Re-Publish local replicants in DRM");
 
-         HashMap localReplicants;
+         Map localReplicants;
          synchronized (this.localReplicants)
          {
             localReplicants = new HashMap(this.localReplicants);
@@ -981,7 +984,7 @@
             while (keys.hasNext())
             {
                String key = (String)keys.next();
-               HashMap replicant = (HashMap)replicants.get(key);
+               Map replicant = (Map)replicants.get(key);
                boolean modified = false;
                for (int i = 0; i < deadMembers.size(); i++)
                {




More information about the jboss-cvs-commits mailing list