You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2013/05/04 22:46:52 UTC

svn commit: r1479172 - /qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java

Author: robbie
Date: Sat May  4 20:45:02 2013
New Revision: 1479172

URL: http://svn.apache.org/r1479172
Log:
QPID-4390: ensure the _messageStore field is populated prior configuring the store to ensure it is set before use by the listener during the asynchronous HA store activation

Modified:
    qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java

Modified: qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java?rev=1479172&r1=1479171&r2=1479172&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java (original)
+++ qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHostImpl.java Sat May  4 20:45:02 2013
@@ -146,7 +146,9 @@ public class VirtualHostImpl implements 
 
         _bindingFactory = new BindingFactory(this);
 
-        _messageStore = configureMessageStore(hostConfig);
+        _messageStore = initialiseMessageStore(hostConfig);
+
+        configureMessageStore(hostConfig);
 
         activateNonHAMessageStore();
 
@@ -260,29 +262,21 @@ public class VirtualHostImpl implements 
         return _houseKeepingTasks.getActiveCount();
     }
 
-
-    private MessageStore initialiseMessageStore(final String messageStoreClass) throws Exception
-    {
-        final Class<?> clazz = Class.forName(messageStoreClass);
-        final Object o = clazz.newInstance();
-
-        if (!(o instanceof MessageStore))
-        {
-            throw new ClassCastException("Message store class must implement " + MessageStore.class +
-                                        ". Class " + clazz + " does not.");
-        }
-
-        final MessageStore messageStore = (MessageStore) o;
-        return messageStore;
-    }
-
-    private MessageStore configureMessageStore(VirtualHostConfiguration hostConfig) throws Exception
+    private MessageStore initialiseMessageStore(VirtualHostConfiguration hostConfig) throws Exception
     {
         String storeType = hostConfig.getConfig().getString("store.type");
         MessageStore  messageStore = null;
         if (storeType == null)
         {
-            messageStore = initialiseMessageStore(hostConfig.getMessageStoreClass());
+            final Class<?> clazz = Class.forName(hostConfig.getMessageStoreClass());
+            final Object o = clazz.newInstance();
+
+            if (!(o instanceof MessageStore))
+            {
+                throw new ClassCastException(clazz + " does not implement " + MessageStore.class);
+            }
+
+            messageStore = (MessageStore) o;
         }
         else
         {
@@ -301,11 +295,6 @@ public class VirtualHostImpl implements 
             messageStore.addEventListener(new AfterInitialisationListener(), Event.AFTER_INIT);
         }
 
-        VirtualHostConfigRecoveryHandler recoveryHandler = new VirtualHostConfigRecoveryHandler(this);
-
-        messageStore.configureConfigStore(getName(), recoveryHandler, hostConfig.getStoreConfiguration());
-        messageStore.configureMessageStore(getName(), recoveryHandler, recoveryHandler, hostConfig.getStoreConfiguration());
-
         return messageStore;
     }
 
@@ -317,6 +306,14 @@ public class VirtualHostImpl implements 
         }
     }
 
+    private void configureMessageStore(VirtualHostConfiguration hostConfig) throws Exception
+    {
+        VirtualHostConfigRecoveryHandler recoveryHandler = new VirtualHostConfigRecoveryHandler(this);
+
+        _messageStore.configureConfigStore(getName(), recoveryHandler, hostConfig.getStoreConfiguration());
+        _messageStore.configureMessageStore(getName(), recoveryHandler, recoveryHandler, hostConfig.getStoreConfiguration());
+    }
+
     private void initialiseModel(VirtualHostConfiguration config) throws ConfigurationException, AMQException
     {
         _logger.debug("Loading configuration for virtualhost: " + config.getName());



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org