qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r894441 - in /qpid/branches/0.5.x-dev/qpid/java/broker/src: main/java/org/apache/qpid/server/ main/java/org/apache/qpid/server/exchange/ main/java/org/apache/qpid/server/handler/ main/java/org/apache/qpid/server/protocol/ main/java/org/apac...
Date Tue, 29 Dec 2009 17:05:55 GMT
Author: robbie
Date: Tue Dec 29 17:05:54 2009
New Revision: 894441

URL: http://svn.apache.org/viewvc?rev=894441&view=rev
Log:
QPID-2096: decouple the addition of durable exchanges to the store from exchange registration

Modified:
    qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
    qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
    qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
    qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java
    qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
    qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java

Modified: qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java?rev=894441&r1=894440&r2=894441&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/AMQBrokerManagerMBean.java
Tue Dec 29 17:05:54 2009
@@ -202,6 +202,10 @@
                     exchange = _exchangeFactory.createExchange(new AMQShortString(exchangeName),
new AMQShortString(type),
                                                                durable, false, 0);
                     _exchangeRegistry.registerExchange(exchange);
+                    if (durable)
+                    {
+                        _messageStore.createExchange(exchange);
+                    }
                 }
                 else
                 {

Modified: qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java?rev=894441&r1=894440&r2=894441&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/exchange/DefaultExchangeRegistry.java
Tue Dec 29 17:05:54 2009
@@ -54,7 +54,7 @@
 
     public void initialise() throws AMQException
     {
-        new ExchangeInitialiser().initialise(_host.getExchangeFactory(), this);
+        new ExchangeInitialiser().initialise(_host.getExchangeFactory(), this, getMessageStore());
     }
 
     public MessageStore getMessageStore()
@@ -65,10 +65,6 @@
     public void registerExchange(Exchange exchange) throws AMQException
     {
         _exchangeMap.put(exchange.getName(), exchange);
-        if (exchange.isDurable())
-        {
-            getMessageStore().createExchange(exchange);
-        }
     }
 
     public void setDefaultExchange(Exchange exchange)

Modified: qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java?rev=894441&r1=894440&r2=894441&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/handler/ExchangeDeclareHandler.java
Tue Dec 29 17:05:54 2009
@@ -92,11 +92,16 @@
                     try
                     {
 
-                    exchange = exchangeFactory.createExchange(body.getExchange() == null
? null : body.getExchange().intern(),
-                                                              body.getType() == null ? null
: body.getType().intern(),
-                                                              body.getDurable(),
-                                                              body.getPassive(), body.getTicket());
-                    exchangeRegistry.registerExchange(exchange);
+                        exchange = exchangeFactory.createExchange(body.getExchange() == null
? null : body.getExchange().intern(),
+                                                                  body.getType() == null
? null : body.getType().intern(),
+                                                                  body.getDurable(),
+                                                                  body.getPassive(), body.getTicket());
+                        exchangeRegistry.registerExchange(exchange);
+                        
+                        if (exchange.isDurable())
+                        {
+                            virtualHost.getMessageStore().createExchange(exchange);
+                        }
                     }
                     catch(AMQUnknownExchangeType e)
                     {

Modified: qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java?rev=894441&r1=894440&r2=894441&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/protocol/ExchangeInitialiser.java
Tue Dec 29 17:05:54 2009
@@ -27,25 +27,32 @@
 import org.apache.qpid.server.exchange.ExchangeFactory;
 import org.apache.qpid.server.exchange.ExchangeRegistry;
 import org.apache.qpid.server.exchange.ExchangeType;
+import org.apache.qpid.server.store.MessageStore;
 
 public class ExchangeInitialiser
 {
-    public void initialise(ExchangeFactory factory, ExchangeRegistry registry) throws AMQException{
+    public void initialise(ExchangeFactory factory, ExchangeRegistry registry, MessageStore
store) throws AMQException{
         for (ExchangeType<? extends Exchange> type : factory.getRegisteredTypes())
         {
-            define (registry, factory, type.getDefaultExchangeName(), type.getName());
+            define (registry, factory, type.getDefaultExchangeName(), type.getName(), store);
         }
         
-        define(registry, factory, ExchangeDefaults.DEFAULT_EXCHANGE_NAME, ExchangeDefaults.DIRECT_EXCHANGE_CLASS);
+        define(registry, factory, ExchangeDefaults.DEFAULT_EXCHANGE_NAME, ExchangeDefaults.DIRECT_EXCHANGE_CLASS,
store);
         registry.setDefaultExchange(registry.getExchange(ExchangeDefaults.DEFAULT_EXCHANGE_NAME));
     }
 
     private void define(ExchangeRegistry r, ExchangeFactory f,
-                        AMQShortString name, AMQShortString type) throws AMQException
+                        AMQShortString name, AMQShortString type, MessageStore store) throws
AMQException
     {
         if(r.getExchange(name)== null)
         {
-            r.registerExchange(f.createExchange(name, type, true, false, 0));
+            Exchange exchange = f.createExchange(name, type, true, false, 0);
+            r.registerExchange(exchange);
+            
+            if(exchange.isDurable())
+            {
+                store.createExchange(exchange);
+            }
         }
     }
 }

Modified: qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java?rev=894441&r1=894440&r2=894441&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
Tue Dec 29 17:05:54 2009
@@ -332,6 +332,11 @@
 
             Exchange newExchange = _exchangeFactory.createExchange(exchangeName, type, durable,
autodelete, 0);
             _exchangeRegistry.registerExchange(newExchange);
+
+            if (newExchange.isDurable())
+            {
+                _messageStore.createExchange(newExchange);
+            }
         }
     }
 

Modified: qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java?rev=894441&r1=894440&r2=894441&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
(original)
+++ qpid/branches/0.5.x-dev/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
Tue Dec 29 17:05:54 2009
@@ -457,6 +457,10 @@
         try
         {
             _virtualHost.getExchangeRegistry().registerExchange(exchange);
+            if (durable)
+            {
+                _virtualHost.getMessageStore().createExchange(exchange);
+            }
         }
         catch (AMQException e)
         {



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message