Author: robbie
Date: Tue Dec 29 17:07:34 2009
New Revision: 894445

URL: http://svn.apache.org/viewvc?rev=894445&view=rev
Log:
QPID-1802: 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:
    
qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java

Modified: 
qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java
URL: 
http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java?rev=894445&r1=894444&r2=894445&view=diff
==============================================================================
--- 
qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java
 (original)
+++ 
qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/store/DerbyMessageStore.java
 Tue Dec 29 17:07:34 2009
@@ -1419,6 +1419,19 @@
                 AMQShortString queueName = new AMQShortString(rs.getString(1));
 
                 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);



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to