[jboss-cvs] JBoss Messaging SVN: r1732 - in branches/Branch_Client_Failover_Experiment/src/main/org/jboss: jms/server/connectionfactory messaging/core/plugin/contract messaging/core/plugin/postoffice/cluster

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 8 16:56:39 EST 2006


Author: timfox
Date: 2006-12-08 16:56:34 -0500 (Fri, 08 Dec 2006)
New Revision: 1732

Modified:
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/ReplicationListener.java
   branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
Log:
HA tweaks



Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-12-08 19:15:03 UTC (rev 1731)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/jms/server/connectionfactory/ConnectionFactoryJNDIMapper.java	2006-12-08 21:56:34 UTC (rev 1732)
@@ -273,7 +273,7 @@
    
    // ReplicationListener interface ----------------------------------
    
-   public synchronized void onReplicationChange(Serializable key, Map updatedReplicantMap)
+   public synchronized void onReplicationChange(Serializable key, Map updatedReplicantMap, boolean added)
    {
       log.info("Got replication call " + key + " node=" + serverPeer.getServerPeerID() + " replicants=" + updatedReplicantMap);
       try
@@ -285,8 +285,10 @@
          
          String sKey = (String)key;
          
-         if (key instanceof String && sKey.startsWith(CF_PREFIX))
+         if (added && key instanceof String && sKey.startsWith(CF_PREFIX))
          {
+            //We only need to rebind if the cf is being added
+            
             String uniqueName = sKey.substring(CF_PREFIX.length());
             
             ClusteredClientConnectionFactoryDelegate clusteredDelegate = createClusteredDelegate(updatedReplicantMap);
@@ -407,7 +409,13 @@
             
             if (failoverIndex == -1)
             {
-               throw new IllegalStateException("Failover node " + failoverNode + " is not in list of nodes at node " + serverPeer.getServerPeerID() + "!");
+               //throw new IllegalStateException("Failover node " + failoverNode + " is not in list of nodes at node " + serverPeer.getServerPeerID() + "!");
+               
+               //It is possible that the failover node is not found  - this might happen
+               //if this is executed when a cf is undeployed but the failover node still contains
+               //the old node.
+               
+               //In this case the node leave event will shortly
             }
             
             failoverIndexes[i] = failoverIndex;
@@ -419,7 +427,7 @@
 
       return clusteredDelegate;
    }
-
+   
    private void rebindConnectionFactory(Context ic,
                                         JNDIBindings jndiBindings,
                                         ClientConnectionFactoryDelegate delegate)

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/ReplicationListener.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/ReplicationListener.java	2006-12-08 19:15:03 UTC (rev 1731)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/contract/ReplicationListener.java	2006-12-08 21:56:34 UTC (rev 1732)
@@ -39,5 +39,5 @@
     * @param updatedReplicantMap - the updated replicant map. It contains ALL current replicants for
     *        the given key.
     */
-   void onReplicationChange(Serializable key, Map updatedReplicantMap);
+   void onReplicationChange(Serializable key, Map updatedReplicantMap, boolean added);
 }

Modified: branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java
===================================================================
--- branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java	2006-12-08 19:15:03 UTC (rev 1731)
+++ branches/Branch_Client_Failover_Experiment/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/DefaultClusteredPostOffice.java	2006-12-08 21:56:34 UTC (rev 1732)
@@ -717,7 +717,7 @@
          
          m.put(new Integer(originatorNodeID), replicant);
          
-         notifyListeners(key, m);
+         notifyListeners(key, m, true);
       }
    }
 
@@ -748,7 +748,7 @@
          {
             replicatedData.remove(key);
          } 
-         notifyListeners(key, m);
+         notifyListeners(key, m, false);
       
          return true; 
       }
@@ -1877,7 +1877,7 @@
             }     
             
             // Need to trigger listeners
-            notifyListeners(key, replicants);
+            notifyListeners(key, replicants, false);
          }
       }
    }
@@ -1886,7 +1886,7 @@
     * @param updatedReplicantMap - the updated replicant map. It contains ALL current replicants for
     *        the given key.
     */
-   private void notifyListeners(Serializable key, Map updatedReplicantMap)
+   private void notifyListeners(Serializable key, Map updatedReplicantMap, boolean added)
    { 
       synchronized (replicationListeners)
       {         
@@ -1894,7 +1894,7 @@
          {
             ReplicationListener listener = (ReplicationListener)i.next();
             
-            listener.onReplicationChange(key, updatedReplicantMap);
+            listener.onReplicationChange(key, updatedReplicantMap, added);
          }
       }
    } 
@@ -2456,7 +2456,7 @@
    private class NodeAddressMapListener implements ReplicationListener
    {
 
-      public void onReplicationChange(Serializable key, Map updatedReplicantMap)
+      public void onReplicationChange(Serializable key, Map updatedReplicantMap, boolean added)
       {
          if (key instanceof String && ((String)key).equals(ADDRESS_INFO_KEY))
          {




More information about the jboss-cvs-commits mailing list