[rhmessaging-commits] rhmessaging commits: r3765 - store/trunk/java/bdbstore/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:39:17 EST 2010


Author: rgemmell
Date: 2010-01-06 15:39:17 -0500 (Wed, 06 Jan 2010)
New Revision: 3765

Modified:
   store/trunk/java/bdbstore/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, preventing creation and registration of a duplicate MBean

Modified: store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java
===================================================================
--- store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2010-01-06 20:37:41 UTC (rev 3764)
+++ store/trunk/java/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStore.java	2010-01-06 20:39:17 UTC (rev 3765)
@@ -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