[jboss-cvs] JBoss Messaging SVN: r2321 - in trunk: tests/src/org/jboss/test/messaging/jms/clustering and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 15 02:46:08 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-02-15 02:46:08 -0500 (Thu, 15 Feb 2007)
New Revision: 2321

Added:
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java
Modified:
   trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
Log:
Fixed temporary queue handling in a clustered configuration; http://jira.jboss.com/jira/browse/JBMESSAGING-841

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2007-02-15 07:33:37 UTC (rev 2320)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerSessionEndpoint.java	2007-02-15 07:46:08 UTC (rev 2321)
@@ -553,11 +553,22 @@
          if (dest.isQueue())
          {
             QueuedExecutor executor = (QueuedExecutor)pool.get();
-            
-            PagingFilteredQueue coreQueue =
-               new PagingFilteredQueue(dest.getName(), idm.getID(), ms, pm, true, false,
-                                       executor, -1, null, fullSize, pageSize, downCacheSize);     
-                        
+            Queue coreQueue;
+
+            if (postOffice.isLocal())
+            {
+               coreQueue = new PagingFilteredQueue(dest.getName(),
+                                                   idm.getID(), ms, pm, true, false, executor,
+                                                   -1, null, fullSize, pageSize, downCacheSize);
+            }
+            else
+            {
+               // uniformly handle the temporary queue as LocalClusteredQueue
+               coreQueue = new LocalClusteredQueue(postOffice, nodeId, dest.getName(),
+                                                   idm.getID(), ms, pm, true, false, executor,
+                                                   -1, null, tr, fullSize, pageSize, downCacheSize);
+            }
+
             String counterName = TEMP_QUEUE_MESSAGECOUNTER_PREFIX + dest.getName();
             
             MessageCounter counter =
@@ -566,7 +577,7 @@
             
             sp.getMessageCounterManager().registerMessageCounter(counterName, counter);
                                  
-            // Make a binding for this queue
+            // make a binding for this queue
             postOffice.bindQueue(new JMSCondition(true, dest.getName()), coreQueue);
          }         
       }

Added: trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java	2007-02-15 07:46:08 UTC (rev 2321)
@@ -0,0 +1,115 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.messaging.jms.clustering;
+
+import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
+
+import javax.jms.Connection;
+import javax.jms.Session;
+import javax.jms.Queue;
+import javax.jms.MessageProducer;
+import javax.jms.MessageConsumer;
+import javax.jms.TextMessage;
+
+/**
+ * A test for temporary destinations in a clustered enviroment.
+ * See http://jira.jboss.org/jira/browse/JBMESSAGING-841.
+ *
+ * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
+ * @version <tt>$Revision$</tt>
+ *
+ * $Id$
+ */
+public class TemporaryQueueTest extends ClusteringTestBase
+{
+   // Constants ------------------------------------------------------------------------------------
+
+   // Static ---------------------------------------------------------------------------------------
+
+   // Attributes -----------------------------------------------------------------------------------
+
+   // Constructors ---------------------------------------------------------------------------------
+
+   public TemporaryQueueTest(String name)
+   {
+      super(name);
+   }
+
+   // Public ---------------------------------------------------------------------------------------
+
+   public void testTemporaryQueue() throws Exception
+   {
+      Connection conn = null;
+
+      try
+      {
+         conn = cf.createConnection();
+
+         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         Queue queue = session.createTemporaryQueue();
+
+         MessageProducer prod = session.createProducer(queue);
+         prod.send(session.createTextMessage("kwijibo"));
+
+         MessageConsumer cons = session.createConsumer(queue);
+         conn.start();
+
+         TextMessage rm = (TextMessage)cons.receive(2000);
+
+         assertNotNull(rm);
+         assertEquals("kwijibo", rm.getText());
+
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void setUp() throws Exception
+   {
+      // just start one node in clustered mode
+      nodeCount = 1;
+
+      super.setUp();
+
+      log.debug("setup done");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+   }
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+}


Property changes on: trunk/tests/src/org/jboss/test/messaging/jms/clustering/TemporaryQueueTest.java
___________________________________________________________________
Name: svn:keywords
   + Id LastChangedDate Author Revision




More information about the jboss-cvs-commits mailing list