activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r1436827 - in /activemq/trunk/activemq-karaf: pom.xml src/main/java/org/apache/activemq/karaf/ActiveMQServiceFactory.java src/main/resources/OSGI-INF/blueprint/activemq-karaf.xml
Date Tue, 22 Jan 2013 10:07:36 GMT
Author: dejanb
Date: Tue Jan 22 10:07:36 2013
New Revision: 1436827

URL: http://svn.apache.org/viewvc?rev=1436827&view=rev
Log:
https://issues.apache.org/jira/browse/AMQ-4034 - adding logging and proper shutdown on destroy

Modified:
    activemq/trunk/activemq-karaf/pom.xml
    activemq/trunk/activemq-karaf/src/main/java/org/apache/activemq/karaf/ActiveMQServiceFactory.java
    activemq/trunk/activemq-karaf/src/main/resources/OSGI-INF/blueprint/activemq-karaf.xml

Modified: activemq/trunk/activemq-karaf/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf/pom.xml?rev=1436827&r1=1436826&r2=1436827&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf/pom.xml (original)
+++ activemq/trunk/activemq-karaf/pom.xml Tue Jan 22 10:07:36 2013
@@ -55,7 +55,6 @@
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
-      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>

Modified: activemq/trunk/activemq-karaf/src/main/java/org/apache/activemq/karaf/ActiveMQServiceFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf/src/main/java/org/apache/activemq/karaf/ActiveMQServiceFactory.java?rev=1436827&r1=1436826&r2=1436827&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf/src/main/java/org/apache/activemq/karaf/ActiveMQServiceFactory.java
(original)
+++ activemq/trunk/activemq-karaf/src/main/java/org/apache/activemq/karaf/ActiveMQServiceFactory.java
Tue Jan 22 10:07:36 2013
@@ -22,6 +22,8 @@ import org.apache.xbean.spring.context.R
 import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedServiceFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.core.io.Resource;
 
@@ -32,6 +34,8 @@ import java.util.Map;
 
 public class ActiveMQServiceFactory implements ManagedServiceFactory {
 
+    private static final Logger LOG = LoggerFactory.getLogger(ActiveMQServiceFactory.class);
+
     BundleContext bundleContext;
     HashMap<String, BrokerService> brokers = new HashMap<String, BrokerService>();
 
@@ -41,7 +45,7 @@ public class ActiveMQServiceFactory impl
     }
 
     @Override
-    public void updated(String pid, Dictionary properties) throws ConfigurationException
{
+    synchronized public void updated(String pid, Dictionary properties) throws ConfigurationException
{
         String config = (String)properties.get("config");
         if (config == null) {
             throw new ConfigurationException("config", "Property must be set");
@@ -77,18 +81,24 @@ public class ActiveMQServiceFactory impl
     }
 
     @Override
-    public void deleted(String pid) {
+    synchronized public void deleted(String pid) {
+        LOG.info("Stopping broker " + pid);
         BrokerService broker = brokers.get(pid);
         if (broker == null) {
-            //TODO LOG
+            LOG.warn("Broker " + pid + " not found");
             return;
         }
         try {
             broker.stop();
             broker.waitUntilStopped();
         } catch (Exception e) {
-            //TODO LOG
-            e.printStackTrace();
+            LOG.error("Exception on stopping broker", e);
+        }
+    }
+
+    synchronized public void destroy() {
+        for (String broker: brokers.keySet()) {
+            deleted(broker);
         }
     }
 

Modified: activemq/trunk/activemq-karaf/src/main/resources/OSGI-INF/blueprint/activemq-karaf.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf/src/main/resources/OSGI-INF/blueprint/activemq-karaf.xml?rev=1436827&r1=1436826&r2=1436827&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf/src/main/resources/OSGI-INF/blueprint/activemq-karaf.xml
(original)
+++ activemq/trunk/activemq-karaf/src/main/resources/OSGI-INF/blueprint/activemq-karaf.xml
Tue Jan 22 10:07:36 2013
@@ -20,7 +20,7 @@
 <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
            xmlns:shell="http://karaf.apache.org/xmlns/shell/v1.0.0">
 
-    <bean id="activeMQServiceFactory" class="org.apache.activemq.karaf.ActiveMQServiceFactory">
+    <bean id="activeMQServiceFactory" class="org.apache.activemq.karaf.ActiveMQServiceFactory"
destroy-method="destroy">
       <property name="bundleContext" ref="blueprintBundleContext"/>
     </bean>
 



Mime
View raw message