[jboss-cvs] JBoss Messaging SVN: r3234 - in trunk/src/main/org/jboss/messaging: util and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Oct 21 07:51:18 EDT 2007


Author: timfox
Date: 2007-10-21 07:51:18 -0400 (Sun, 21 Oct 2007)
New Revision: 3234

Modified:
   trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
   trunk/src/main/org/jboss/messaging/util/ClearableSemaphore.java
Log:
Now send back responses always


Modified: trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2007-10-21 11:05:42 UTC (rev 3233)
+++ trunk/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2007-10-21 11:51:18 UTC (rev 3234)
@@ -1215,18 +1215,20 @@
    	{
    		//This is ok - the queue might not have been deployed yet - when the queue is deployed it
    		//will request for deliveries to be sent to it in a batch
-   		return;
+   		//We still send back a response though to prevent the sender blocking waiting for a reply
    	}
+   	else
+   	{   	
+	   	Queue queue = binding.queue;
+	   	
+	   	queue.addToRecoveryArea(nodeID, messageID, sessionID);   	
+   	}
    	
-   	Queue queue = binding.queue;
-   	
-   	queue.addToRecoveryArea(nodeID, messageID, sessionID);   	
-   	
    	if (trace) { log.trace(this + " reply address is " + replyAddress); }
    	
    	if (replyAddress != null)
    	{   	
-	   	//Now we send back a response saying we have added it ok
+	   	//Now we send back a response
    		
    		if (trace) { log.trace("Sending back response"); }
 	   	
@@ -2778,7 +2780,7 @@
    	
    	if (trace) { log.trace("Failover node has changed from " + oldFailoverNodeID + " to " + failoverNodeID); }   	  	
    	
-   	replicateSemaphore.disable();	 
+   	replicateSemaphore.reset();
    	
    	if (!firstNode)
    	{	   	
@@ -2845,8 +2847,6 @@
 			   		
 			   		if (trace) { log.trace("Sent AddAllReplicatedDeliveriesMessage"); }
 					}
-					
-					replicateSemaphore.enable();
 	   		}
 	   	}  	
    	}   	
@@ -3045,8 +3045,6 @@
       				{
       					gotSome = true;
       				}      				
-      				//Release them all
-						replicateSemaphore.enable();
       			}   				  
       			
       			if (gotSome)

Modified: trunk/src/main/org/jboss/messaging/util/ClearableSemaphore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/util/ClearableSemaphore.java	2007-10-21 11:05:42 UTC (rev 3233)
+++ trunk/src/main/org/jboss/messaging/util/ClearableSemaphore.java	2007-10-21 11:51:18 UTC (rev 3234)
@@ -52,24 +52,15 @@
 		}
 	}
 	
-	public synchronized void enable()
+	public synchronized void reset()
 	{
-		if (semaphore == null)
-		{
-			createSemaphore();
-		}
-	}
-	
-	// We need to be able to disable the semaphore since during failover requests may be sent but responses
-	// may not come back (node is dead or hasn't loaded it's queues yet)
-	// In which case we don't want to acquire a token since we might end up locking and using up all permits	
-	public synchronized void disable()
-	{
 		if (semaphore != null)
 		{
-			semaphore.release(permits);
+			Semaphore oldSem = semaphore;
 			
-			semaphore = null;
+			createSemaphore();
+			
+			oldSem.release(permits);
 		}
 	}
 }




More information about the jboss-cvs-commits mailing list