[jboss-cvs] JBoss Messaging SVN: r6499 - trunk/src/main/org/jboss/messaging/core/server/impl.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 20 12:17:27 EDT 2009


Author: jmesnil
Date: 2009-04-20 12:17:27 -0400 (Mon, 20 Apr 2009)
New Revision: 6499

Modified:
   trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
Log:
MessagingServer lifecycle

* delayed the creation of the queues loaded from the journal and the load of messages from the journal *after* the deployment manager is started to ensure the address settings have been configured (otherwise, we use the default address settings, not the one defined by the user in the config file)

Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-04-20 15:30:50 UTC (rev 6498)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java	2009-04-20 16:17:27 UTC (rev 6499)
@@ -286,29 +286,11 @@
       pagingManager.start();
 
       managementService.start();
-
-      // Start the deployers
-      if (configuration.isEnableFileDeployment())
-      {
-         basicUserCredentialsDeployer = new BasicUserCredentialsDeployer(deploymentManager, securityManager);
-
-         addressSettingsDeployer = new AddressSettingsDeployer(deploymentManager, addressSettingsRepository);
-
-         queueDeployer = new QueueDeployer(deploymentManager, configuration);
-
-         securityDeployer = new SecurityDeployer(deploymentManager, securityRepository);
-
-         basicUserCredentialsDeployer.start();
-
-         addressSettingsDeployer.start();
-
-         queueDeployer.start();
-
-         securityDeployer.start();
-      }
       
       List<QueueBindingInfo> queueBindingInfos = new ArrayList<QueueBindingInfo>();
 
+      // the bindings info must be loaded now since it has the side-effect
+      // to setup the ID generator of the storage manager
       storageManager.loadBindingJournal(queueBindingInfos);
 
       if (!configuration.isBackup())
@@ -355,50 +337,6 @@
                                                                 queueFactory,
                                                                 configuration.isBackup());
 
-      Map<Long, Queue> queues = new HashMap<Long, Queue>();
-
-      for (QueueBindingInfo queueBindingInfo : queueBindingInfos)
-      {
-         Filter filter = null;
-
-         if (queueBindingInfo.getFilterString() != null)
-         {
-            filter = new FilterImpl(queueBindingInfo.getFilterString());
-         }
-
-         Queue queue = queueFactory.createQueue(queueBindingInfo.getPersistenceID(),
-                                                queueBindingInfo.getAddress(),
-                                                queueBindingInfo.getQueueName(),
-                                                filter,
-                                                true,
-                                                false);
-
-         Binding binding = new LocalQueueBinding(queueBindingInfo.getAddress(), queue, nodeID);
-
-         queues.put(queueBindingInfo.getPersistenceID(), queue);
-
-         postOffice.addBinding(binding);
-      }
-
-      Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap = new HashMap<SimpleString, List<Pair<byte[], Long>>>();
-
-      storageManager.loadMessageJournal(pagingManager,
-                                        resourceManager,
-                                        queues,
-                                        duplicateIDMap);
-
-      for (Map.Entry<SimpleString, List<Pair<byte[], Long>>> entry : duplicateIDMap.entrySet())
-      {
-         SimpleString address = entry.getKey();
-
-         DuplicateIDCache cache = postOffice.getDuplicateIDCache(address);
-
-         if (configuration.isPersistIDCache())
-         {
-            cache.load(entry.getValue());
-         }
-      }
-
       resourceManager.start();
 
       // Deply any pre-defined diverts
@@ -463,6 +401,26 @@
       // This is the last thing done at the start, after everything else is up and running
       pagingManager.startGlobalDepage();
 
+      // Start the deployers
+      if (configuration.isEnableFileDeployment())
+      {
+         basicUserCredentialsDeployer = new BasicUserCredentialsDeployer(deploymentManager, securityManager);
+
+         addressSettingsDeployer = new AddressSettingsDeployer(deploymentManager, addressSettingsRepository);
+
+         queueDeployer = new QueueDeployer(deploymentManager, configuration);
+
+         securityDeployer = new SecurityDeployer(deploymentManager, securityRepository);
+
+         basicUserCredentialsDeployer.start();
+
+         addressSettingsDeployer.start();
+
+         queueDeployer.start();
+
+         securityDeployer.start();
+      }
+
       if (!configuration.isBackup())
       {         
          if (deploymentManager != null)
@@ -477,6 +435,51 @@
          deployQueues();
       }
       
+      // TODO all queues should be deployed from deployQueues() wether they come from the journal or the conf
+      Map<Long, Queue> queues = new HashMap<Long, Queue>();
+
+      for (QueueBindingInfo queueBindingInfo : queueBindingInfos)
+      {
+         Filter filter = null;
+
+         if (queueBindingInfo.getFilterString() != null)
+         {
+            filter = new FilterImpl(queueBindingInfo.getFilterString());
+         }
+
+         Queue queue = queueFactory.createQueue(queueBindingInfo.getPersistenceID(),
+                                                queueBindingInfo.getAddress(),
+                                                queueBindingInfo.getQueueName(),
+                                                filter,
+                                                true,
+                                                false);
+
+         Binding binding = new LocalQueueBinding(queueBindingInfo.getAddress(), queue, nodeID);
+
+         queues.put(queueBindingInfo.getPersistenceID(), queue);
+
+         postOffice.addBinding(binding);
+      }
+
+      Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap = new HashMap<SimpleString, List<Pair<byte[], Long>>>();
+
+      storageManager.loadMessageJournal(pagingManager,
+                                        resourceManager,
+                                        queues,
+                                        duplicateIDMap);
+
+      for (Map.Entry<SimpleString, List<Pair<byte[], Long>>> entry : duplicateIDMap.entrySet())
+      {
+         SimpleString address = entry.getKey();
+
+         DuplicateIDCache cache = postOffice.getDuplicateIDCache(address);
+
+         if (configuration.isPersistIDCache())
+         {
+            cache.load(entry.getValue());
+         }
+      }
+
       if (clusterManager != null)
       {
          clusterManager.start();




More information about the jboss-cvs-commits mailing list