[jboss-cvs] JBoss Messaging SVN: r3121 - trunk/src/main/org/jboss/jms/server/destination.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 19 11:17:21 EDT 2007


Author: jhowell at redhat.com
Date: 2007-09-19 11:17:20 -0400 (Wed, 19 Sep 2007)
New Revision: 3121

Modified:
   trunk/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
   trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java
Log:
http://jira.jboss.com/jira/browse/JBMESSAGING-978 - Fixed setMaxSize ordering with start.

Modified: trunk/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2007-09-19 14:58:45 UTC (rev 3120)
+++ trunk/src/main/org/jboss/jms/server/destination/DestinationServiceSupport.java	2007-09-19 15:17:20 UTC (rev 3121)
@@ -6,14 +6,20 @@
  */
 package org.jboss.jms.server.destination;
 
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.StringTokenizer;
 
 import javax.management.InstanceNotFoundException;
 import javax.management.ObjectName;
 
+import org.jboss.jms.server.JMSCondition;
 import org.jboss.jms.server.ServerPeer;
 import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.messaging.core.contract.Condition;
 import org.jboss.messaging.core.contract.MessagingComponent;
+import org.jboss.messaging.core.contract.PostOffice;
+import org.jboss.messaging.core.contract.Queue;
 import org.jboss.messaging.util.ExceptionUtil;
 import org.jboss.system.ServiceMBeanSupport;
 import org.w3c.dom.Element;
@@ -87,6 +93,9 @@
                	
          nodeId = serverPeer.getServerPeerID();
          
+         
+         
+         
          String name = null;
                   
          if (serviceName != null)
@@ -102,7 +111,9 @@
          }                  
          
          destination.setName(name);         
-         
+         //must be set after the peer is set on the destination.
+         //http://jira.jboss.com/jira/browse/JBMESSAGING-1075
+         this.setMaxSizeForQueues();
          // http://jira.jboss.com/jira/browse/JBMESSAGING-976
          if (destination.getSecurityConfig() != null)
          {
@@ -245,9 +256,34 @@
       return destination.getMaxSize();
    }
    
+   /**
+    * This is post startup processing for MaxSize for Queues.  This can also be set during runtime, 
+    * given that the destination service is started. Setting max size requires
+    * that the peer be setup. http://jira.jboss.com/jira/browse/JBMESSAGING-1075
+    * @throws Exception if  the post office can't be reached.
+    */
+   private void setMaxSizeForQueues() throws Exception
+   {
+	   Condition cond = new JMSCondition(isQueue(), this.getName());	      
+	   PostOffice postOffice = serverPeer.getPostOfficeInstance();	      
+	   Collection subs = postOffice.getQueuesForCondition(cond, true);	      
+	   Iterator iter = subs.iterator();
+	   while (iter.hasNext())
+	   {
+	      Queue queue = (Queue)iter.next();	         
+	      queue.setMaxSize(this.getMaxSize());
+	   }
+   }
+   
    public void setMaxSize(int maxSize) throws Exception
    {
-      destination.setMaxSize(maxSize);
+	  destination.setMaxSize(maxSize);
+	  //added so that max size can be changed on the fly
+	  //http://jira.jboss.com/jira/browse/JBMESSAGING-1075
+	  if(started)
+      {
+    	this.setMaxSizeForQueues();
+      }
    }
    
    public Element getSecurityConfig()

Modified: trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java	2007-09-19 14:58:45 UTC (rev 3120)
+++ trunk/src/main/org/jboss/jms/server/destination/ManagedDestination.java	2007-09-19 15:17:20 UTC (rev 3121)
@@ -273,23 +273,16 @@
       return maxSize;
    }
    
+   /**
+    * Sets the max size for the destination.  This will only set the MaxSize field.  Processing must be
+    * done to enable this for the queues.  
+    * @param maxSize
+    * @throws Exception
+    */
    public void setMaxSize(int maxSize) throws Exception
    {
-      Condition cond = new JMSCondition(isQueue(), name);
-      
-      PostOffice postOffice = serverPeer.getPostOfficeInstance();
-      
-      Collection subs = postOffice.getQueuesForCondition(cond, true);
-      
-      Iterator iter = subs.iterator();
-
-      while (iter.hasNext())
-      {
-         Queue queue = (Queue)iter.next();
-         
-         queue.setMaxSize(maxSize);
-      }
-      
+      //took out processing for max size and moved it into the DestinationServiceSupport 
+	  //http://jira.jboss.com/jira/browse/JBMESSAGING-1075
       this.maxSize = maxSize;
    }
    




More information about the jboss-cvs-commits mailing list