[jboss-cvs] JBoss Messaging SVN: r2952 - trunk/src/main/org/jboss/messaging/core/impl/postoffice.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 3 11:38:46 EDT 2007


Author: timfox
Date: 2007-08-03 11:38:46 -0400 (Fri, 03 Aug 2007)
New Revision: 2952

Modified:
   trunk/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java
   trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
Get deliveries if node is added and binding already exists


Modified: trunk/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java	2007-08-03 12:32:13 UTC (rev 2951)
+++ trunk/src/main/org/jboss/messaging/core/impl/postoffice/GroupMember.java	2007-08-03 15:38:46 UTC (rev 2952)
@@ -180,7 +180,7 @@
       			throw new IllegalStateException("Timed out waiting for first view to arrive");
       		}
       	}
-	      	      
+      	
 	   	//Now we can be considered started
 	   	started = true;	   	
    	}

Modified: trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2007-08-03 12:32:13 UTC (rev 2951)
+++ trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2007-08-03 15:38:46 UTC (rev 2952)
@@ -432,50 +432,15 @@
    		waitForBindUnbind(binding.queue.getName(), true);
    	}
    	
-   	if (added && !firstNode && supportsFailover && clustered && binding.queue.isClustered())
+   	if (added)
    	{
-   		//reverse lookup in failover map
-   		
-   		Integer masterNodeID = getMasterForFailoverNodeID(thisNodeID);
-   		   		   		
-   		if (masterNodeID != null)
-   		{
-   			Map nameMap = (Map)nameMaps.get(masterNodeID);
-   			
-   			if (nameMap != null)
-   			{
-   				Binding b = (Binding)nameMap.get(binding.queue.getName());
-   				
-   				if (b != null)
-   				{
-   					//Already deployed on master node - tell the master to send us the deliveries
-   					//This copes with the case when queues were deployed on the failover before being deployed on the master
-   					
-   					if (trace) { log.trace("Telling master to send us deliveries"); }
-   					
-   					PostOfficeAddressInfo info = (PostOfficeAddressInfo)nodeIDAddressMap.get(new Integer(thisNodeID));
-   		   		
-   		   		Address replyAddress = info.getControlChannelAddress();
-   					
-   					ClusterRequest request = new GetReplicatedDeliveriesRequest(binding.queue.getName(), replyAddress);
-   					
-   				   info = (PostOfficeAddressInfo)nodeIDAddressMap.get(masterNodeID);
-   				   			   
-   				   Address address = info.getControlChannelAddress();
-   				   
-   				   log.info("Sending the message to node " + masterNodeID + " with address " + address);
-   			   	   				   	
-   				   if (address != null)
-   				   {	   
-   				   	groupMember.unicastControl(request, address, false);
-   				   }
-   				}
-   			}
-   		}
+   		requestDeliveries(binding.queue);
    	}
    	
    	return added;
    }
+   
+   
           
    public Binding removeBinding(String queueName, boolean allNodes) throws Throwable
    {
@@ -1608,6 +1573,53 @@
    	replyExecutor.shutdownNow();   	
    }
    
+   private void requestDeliveries(Queue queue) throws Exception
+   {
+   	if (!firstNode && supportsFailover && clustered && queue.isClustered())
+   	{
+	   	// reverse lookup in failover map
+			
+			Integer masterNodeID = getMasterForFailoverNodeID(thisNodeID);
+			   		   		
+			if (masterNodeID != null)
+			{
+				Map nameMap = (Map)nameMaps.get(masterNodeID);
+				
+				if (nameMap != null)
+				{
+					Binding b = (Binding)nameMap.get(queue.getName());
+					
+					if (b != null)
+					{
+						//Already deployed on master node - tell the master to send us the deliveries
+						//This copes with the case when queues were deployed on the failover before being deployed on the master
+						
+						if (trace) { log.trace("Telling master to send us deliveries"); }
+						
+						dumpFailoverMap(this.failoverMap);
+						
+						PostOfficeAddressInfo info = (PostOfficeAddressInfo)nodeIDAddressMap.get(new Integer(thisNodeID));
+			   		
+			   		Address replyAddress = info.getControlChannelAddress();
+						
+						ClusterRequest request = new GetReplicatedDeliveriesRequest(queue.getName(), replyAddress);
+						
+					   info = (PostOfficeAddressInfo)nodeIDAddressMap.get(masterNodeID);
+					   			   
+					   Address address = info.getControlChannelAddress();
+					   
+					   log.info("Sending the message to node " + masterNodeID + " with address " + address);
+				   	   				   	
+					   if (address != null)
+					   {	   
+					   	groupMember.unicastControl(request, address, false);
+					   }
+					}
+				}
+			}
+   	}
+   }
+   
    private Integer getMasterForFailoverNodeID(long failoverNodeID)
    {
    	//reverse lookup of master node id given failover node id
@@ -2455,6 +2467,8 @@
 
             groupMember.multicastControl(request, false);         
          }      	
+         
+         requestDeliveries(queue);
       }
    }
     




More information about the jboss-cvs-commits mailing list