activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1126628 - in /activemq/activemq-apollo/trunk: apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
Date Mon, 23 May 2011 18:16:18 GMT
Author: chirino
Date: Mon May 23 18:16:18 2011
New Revision: 1126628

URL: http://svn.apache.org/viewvc?rev=1126628&view=rev
Log:
Fixes https://issues.apache.org/jira/browse/APLO-22 : Support generic service plugins to on
a broker so that admins can start/stop additional opaque services along /w the broker.

Modified:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
    activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1126628&r1=1126627&r2=1126628&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
Mon May 23 18:16:18 2011
@@ -219,6 +219,7 @@ class Broker() extends BaseService {
   var security_log:Log  = _
   var connection_log:Log = _
   var console_log:Log = _
+  var services = List[Service]()
 
   override def toString() = "broker: "+id
 
@@ -302,6 +303,10 @@ class Broker() extends BaseService {
         connectors ::= connector
       }
 
+
+      services = (config.services.map { clazz =>
+        Broker.class_loader.loadClass(clazz).newInstance().asInstanceOf[Service]
+      }).toList
     }
 
     BrokerRegistry.add(this)
@@ -325,12 +330,17 @@ class Broker() extends BaseService {
     )
 
     // Once virtual hosts are up.. start up the connectors.
-    first_tracker.callback(^{
-      connectors.foreach( x=>
-        second_tracker.start(x)
-      )
-      second_tracker.callback(on_completed)
-    })
+    first_tracker.callback{
+      connectors.foreach(second_tracker.start(_))
+      second_tracker.callback {
+        // Once the connectors are up, start the services.
+        val services_tracker = new LoggingTracker("broker startup", console_log, dispatch_queue)
+        services.foreach( x=>
+          first_tracker.start(x)
+        )
+        services_tracker.callback(on_completed)
+      }
+    }
 
   }
 
@@ -338,6 +348,11 @@ class Broker() extends BaseService {
   def _stop(on_completed:Runnable): Unit = {
     val tracker = new LoggingTracker("broker shutdown", console_log, dispatch_queue)
 
+    // Stop the services...
+    services.foreach( x=>
+      tracker.stop(x)
+    )
+
     // Stop accepting connections..
     connectors.foreach( x=>
       tracker.stop(x)

Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java?rev=1126628&r1=1126627&r2=1126628&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
(original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
Mon May 23 18:16:18 2011
@@ -73,5 +73,13 @@ public class BrokerDTO {
     @XmlElement(name="log_category")
     public LogCategoryDTO log_category;
 
+    /**
+     * Opaque service class names which gets started/stopped when the broker
+     * starts/stops.
+     */
+    @XmlElement(name="service")
+    public List<String> services = new ArrayList<String>();
+
+
     public Boolean sticky_dispatching;
 }



Mime
View raw message