activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1134768 - /activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
Date Sat, 11 Jun 2011 21:25:35 GMT
Author: chirino
Date: Sat Jun 11 21:25:35 2011
New Revision: 1134768

URL: http://svn.apache.org/viewvc?rev=1134768&view=rev
Log:
Fixes https://issues.apache.org/jira/browse/APLO-44 : Eagerly create destinations which are
explicitly defined in the server configuration file.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala?rev=1134768&r1=1134767&r2=1134768&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
Sat Jun 11 21:25:35 2011
@@ -30,6 +30,8 @@ import security.SecurityContext
 import java.util.concurrent.TimeUnit
 import collection.mutable.ListBuffer._
 import collection.mutable.HashMap._
+import scala.Array
+import tools.nsc.doc.model.ProtectedInInstance
 
 trait DomainDestination {
 
@@ -630,6 +632,24 @@ class LocalRouter(val virtual_host:Virtu
   //
   /////////////////////////////////////////////////////////////////////////////
 
+  protected def create_configure_destinations {
+    def create_configured_dests(list: ArrayList[_ <: StringIdDTO], d: Domain[_], f: (Array[String])
=> DestinationDTO) = {
+      import collection.JavaConversions._
+      list.foreach {
+        dto =>
+          if (dto.id != null) {
+            val parts = destination_parser.parts(dto.id)
+            val path = destination_parser.decode_path(parts)
+            if (!PathParser.containsWildCards(path)) {
+              d.get_or_create_destination(path, f(parts), null)
+            }
+          }
+      }
+    }
+    create_configured_dests(virtual_host.config.queues, queue_domain, (parts) => new QueueDestinationDTO(parts))
+    create_configured_dests(virtual_host.config.topics, topic_domain, (parts) => new TopicDestinationDTO(parts))
+  }
+
   protected def _start(on_completed: Runnable) = {
     val tracker = new LoggingTracker("router startup", virtual_host.console_log, dispatch_queue)
     if( virtual_host.store!=null ) {
@@ -666,7 +686,14 @@ class LocalRouter(val virtual_host:Virtu
       schedule_connection_regroup
     }
 
-    tracker.callback(on_completed)
+    tracker.callback {
+      // Now that we have restored persistent destinations,
+      // make sure we create any NON-wildcard destinations
+      // explicitly listed in the config.
+
+      create_configure_destinations
+      on_completed.run()
+    }
   }
 
   protected def _stop(on_completed: Runnable) = {
@@ -915,6 +942,8 @@ class LocalRouter(val virtual_host:Virtu
     val tracker = new LoggingTracker("domain update", virtual_host.broker.console_log, dispatch_queue)
     topic_domain.apply_update(tracker)
     queue_domain.apply_update(tracker)
+    // we may need to create some more destinations.
+    create_configure_destinations
     tracker.callback(on_completed)
   }
 }
\ No newline at end of file



Mime
View raw message