[rhmessaging-commits] rhmessaging commits: r3761 - store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Jan 6 15:18:27 EST 2010


Author: rgemmell
Date: 2010-01-06 15:18:27 -0500 (Wed, 06 Jan 2010)
New Revision: 3761

Modified:
   store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
Log:
If the queue was not in the store, check that there isnt already a queue in the virtualhost from earlier in the startup cycle before creating a new queue to deliver any recovered messages to, thus preventing creation and registration of a duplicate MBean.


Modified: store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
===================================================================
--- store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2010-01-06 20:15:26 UTC (rev 3760)
+++ store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2010-01-06 20:18:27 UTC (rev 3761)
@@ -1651,8 +1651,21 @@
                 AMQShortString queueName = dd.queueName;
 
                 AMQQueue queue = queues.get(queueName);
+                
+                // If the matching queue was not already found in the store, check in case a queue
+                // with the same name exists in the virtualhost, otherwise we will create a duplicate
+                // queue and generate a JMX InstanceAlreadyExistsException, preventing startup.
                 if (queue == null)
                 {
+                    queue = _virtualHost.getQueueRegistry().getQueue(queueName);
+                    if (queue != null)
+                    {
+                        queues.put(queueName, queue);
+                    }
+                }
+                
+                if (queue == null)
+                {
                     queue = AMQQueueFactory.createAMQQueueImpl(queueName, false, null, false, _virtualHost, null);
                     _virtualHost.getQueueRegistry().registerQueue(queue);
                     queues.put(queueName, queue);



More information about the rhmessaging-commits mailing list