From commits-return-12834-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Wed Jan 20 12:54:35 2010 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 73072 invoked from network); 20 Jan 2010 12:54:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jan 2010 12:54:35 -0000 Received: (qmail 84820 invoked by uid 500); 20 Jan 2010 12:54:35 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 84772 invoked by uid 500); 20 Jan 2010 12:54:35 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 84758 invoked by uid 99); 20 Jan 2010 12:54:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 12:54:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jan 2010 12:54:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B81F323889D5; Wed, 20 Jan 2010 12:54:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r901171 - in /activemq/trunk: activemq-core/pom.xml activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java pom.xml Date: Wed, 20 Jan 2010 12:54:07 -0000 To: commits@activemq.apache.org From: dejanb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100120125407.B81F323889D5@eris.apache.org> 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 @@ org.osgi.core + + org.springframework.osgi + spring-osgi-core + + org.apache.activemq 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 @@ scp://people.apache.org/x1/www/activemq.apache.org 2.5.6 + 1.2.1 1.3 0.1.0 1.7.1 @@ -582,6 +583,11 @@ spring-oxm-tiger ${spring-oxm-version} + + org.springframework.osgi + spring-osgi-core + ${spring-osgi-version} +