[jboss-cvs] JBoss Messaging SVN: r3941 - in branches/Branch_Stable/src/main/org/jboss: messaging/core/impl and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 26 00:28:56 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-03-26 00:28:56 -0400 (Wed, 26 Mar 2008)
New Revision: 3941

Modified:
   branches/Branch_Stable/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
   branches/Branch_Stable/src/main/org/jboss/messaging/core/impl/MessagingQueue.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-1263 - Adding synchronization

Modified: branches/Branch_Stable/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- branches/Branch_Stable/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2008-03-25 20:18:52 UTC (rev 3940)
+++ branches/Branch_Stable/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2008-03-26 04:28:56 UTC (rev 3941)
@@ -685,8 +685,6 @@
 
    boolean sendMessage(JBossMessage msg, Transaction tx, boolean checkForDuplicates) throws Exception
    {
-      if (trace) { log.trace(this + " sending message " + msg + (tx == null ? " non-transactionally" : " in " + tx)); }
-
       JBossDestination dest = (JBossDestination)msg.getJMSDestination();
 
       if (!dest.isDirect())
@@ -696,6 +694,9 @@
          msg.setMessageId(msgID);
       }
 
+      // Trace after the messageID was generated
+      if (trace) { log.trace(this + " sending message " + msg + (tx == null ? " non-transactionally" : " in " + tx)); }
+
       // This allows the no-local consumers to filter out the messages that come from the same
       // connection.
 
@@ -727,6 +728,7 @@
 
       if (dest.isDirect())
       {
+         if (trace) { log.trace(this + " routing " + msg + " to direct destination"); }
       	//Route directly to queue - temp kludge for clustering
 
       	Binding binding = postOffice.getBindingForQueueName(dest.getName());
@@ -749,13 +751,15 @@
       }
       else if (dest.isQueue())
       {
-         if (!postOffice.route(ref, new JMSCondition(true, dest.getName()), tx))
+         if (trace) { log.trace(this + " routing " + msg + " to queue"); }
+        if (!postOffice.route(ref, new JMSCondition(true, dest.getName()), tx))
          {
             throw new JMSException("Failed to route " + ref + " to " + dest.getName());
          }
       }
       else
       {
+         if (trace) { log.trace(this + " routing " + msg + " to postoffice"); }
          postOffice.route(ref, new JMSCondition(false, dest.getName()), tx);
       }
 

Modified: branches/Branch_Stable/src/main/org/jboss/messaging/core/impl/MessagingQueue.java
===================================================================
--- branches/Branch_Stable/src/main/org/jboss/messaging/core/impl/MessagingQueue.java	2008-03-25 20:18:52 UTC (rev 3940)
+++ branches/Branch_Stable/src/main/org/jboss/messaging/core/impl/MessagingQueue.java	2008-03-26 04:28:56 UTC (rev 3941)
@@ -517,9 +517,9 @@
 		}
 	}
    
-   protected void setReceiversReady(boolean receiversReady)
+   protected synchronized void setReceiversReady(boolean receiversReady)
    {
-   	if (trace) { log.trace(this + " setReceiversReady " + receiversReady); }
+   	if (trace) { log.trace(this + " setReceiversReady " + receiversReady, new Exception("trace")); }
    	
    	this.receiversReady = receiversReady;
    	
@@ -555,7 +555,7 @@
    
    // Private -------------------------------------------------------
    
-   private void informSuckers(boolean consume)
+   private synchronized void informSuckers(boolean consume)
    {
    	Iterator iter = suckers.iterator();
    	
@@ -618,12 +618,25 @@
 
 		public synchronized boolean remove(Receiver receiver)
 		{   	
+		   if (trace)
+		   {
+		      log.trace(MessagingQueue.this + " removing receiver " + receiver, new Exception ("trace"));
+		   }
 	      boolean removed = distributor.remove(receiver);
 	      
+	      if (trace)
+	      {
+	         log.trace(MessagingQueue.this + " removed = " + removed);
+	      }
+	      
 	      if (removed)
 	      {
 	      	if (localDistributor.getNumberOfReceivers() == 0)
 		      {
+	      	   if (trace)
+	      	   {
+	      	      log.trace("Stopping suckers");
+	      	   }
 		      	//Stop pulling from other queues into this one.
 		      	informSuckers(false);
 		      	




More information about the jboss-cvs-commits mailing list