You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2010/01/20 13:54:07 UTC
svn commit: r901171 - in /activemq/trunk: activemq-core/pom.xml
activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
pom.xml
Author: dejanb
Date: Wed Jan 20 12:54:07 2010
New Revision: 901171
URL: http://svn.apache.org/viewvc?rev=901171&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQ-2574 - stop osgi bundle on application context close
Modified:
activemq/trunk/activemq-core/pom.xml
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
activemq/trunk/pom.xml
Modified: activemq/trunk/activemq-core/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/pom.xml?rev=901171&r1=901170&r2=901171&view=diff
==============================================================================
--- activemq/trunk/activemq-core/pom.xml (original)
+++ activemq/trunk/activemq-core/pom.xml Wed Jan 20 12:54:07 2010
@@ -97,6 +97,11 @@
<artifactId>org.osgi.core</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-core</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.apache.activemq</groupId>
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java?rev=901171&r1=901170&r2=901171&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java Wed Jan 20 12:54:07 2010
@@ -20,12 +20,16 @@
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.usage.SystemUsage;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleException;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
/**
* An ActiveMQ Message Broker. It consists of a number of transport
@@ -42,7 +46,8 @@
* @version $Revision: 1.1 $
*/
public class XBeanBrokerService extends BrokerService implements InitializingBean, DisposableBean, ApplicationContextAware {
-
+ private static final transient Log LOG = LogFactory.getLog(XBeanBrokerService.class);
+
private boolean start = true;
private ApplicationContext applicationContext = null;
private boolean destroyApplicationContextOnShutdown = false;
@@ -61,6 +66,14 @@
if (applicationContext instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) applicationContext).close();
}
+ if (applicationContext instanceof OsgiBundleXmlApplicationContext){
+ try {
+ ((OsgiBundleXmlApplicationContext)applicationContext).getBundle().stop();
+ } catch (BundleException e) {
+ LOG.info("Error stopping OSGi bundle " + e, e);
+ }
+ }
+
}
});
}
Modified: activemq/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/pom.xml?rev=901171&r1=901170&r2=901171&view=diff
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Wed Jan 20 12:54:07 2010
@@ -37,6 +37,7 @@
<!-- base url for site deployment. See distribution management for full url. Override this in settings.xml for staging -->
<staging.siteURL>scp://people.apache.org/x1/www/activemq.apache.org</staging.siteURL>
<spring-version>2.5.6</spring-version>
+ <spring-osgi-version>1.2.1</spring-osgi-version>
<activesoap-version>1.3</activesoap-version>
<annogen-version>0.1.0</annogen-version>
<ant-version>1.7.1</ant-version>
@@ -582,6 +583,11 @@
<artifactId>spring-oxm-tiger</artifactId>
<version>${spring-oxm-version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.osgi</groupId>
+ <artifactId>spring-osgi-core</artifactId>
+ <version>${spring-osgi-version}</version>
+ </dependency>
<!-- Optional Derby support-->
<dependency>