Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1C13910D9F for ; Tue, 21 Jan 2014 12:05:03 +0000 (UTC) Received: (qmail 18949 invoked by uid 500); 21 Jan 2014 12:05:01 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 18829 invoked by uid 500); 21 Jan 2014 12:05:01 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 18816 invoked by uid 99); 21 Jan 2014 12:04:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jan 2014 12:04:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Tue, 21 Jan 2014 12:04:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6323D23888A6; Tue, 21 Jan 2014 12:04:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1559994 - in /cxf/branches/2.6.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java rt/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java Date: Tue, 21 Jan 2014 12:04:38 -0000 To: commits@cxf.apache.org From: ningjiang@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140121120438.6323D23888A6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ningjiang Date: Tue Jan 21 12:04:37 2014 New Revision: 1559994 URL: http://svn.apache.org/r1559994 Log: Merged revisions 1559989 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes CXF-5505 SpringBus should shutdown the bus when the application context is closed Modified: cxf/branches/2.6.x-fixes/ (props changed) cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java cxf/branches/2.6.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Merged /cxf/branches/2.7.x-fixes:r1559989 Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java?rev=1559994&r1=1559993&r2=1559994&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java (original) +++ cxf/branches/2.6.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java Tue Jan 21 12:04:37 2014 @@ -23,7 +23,6 @@ import java.util.List; import org.apache.cxf.bus.BusState; import org.apache.cxf.bus.extension.ExtensionManagerBus; -import org.apache.cxf.buslifecycle.BusLifeCycleManager; import org.apache.cxf.configuration.ConfiguredBeanLocator; import org.apache.cxf.configuration.Configurer; import org.apache.cxf.configuration.spring.ConfigurerImpl; @@ -126,8 +125,10 @@ public class SpringBus extends Extension if (getState() != BusState.RUNNING) { initialize(); } - } else if (event instanceof ContextClosedEvent) { - getExtension(BusLifeCycleManager.class).postShutdown(); + } else if (event instanceof ContextClosedEvent && getState() == BusState.RUNNING) { + // The bus could be create by using SpringBusFactory.createBus("/cxf.xml"); + // Just to make sure the shutdown is called rightly + shutdown(); } } } Modified: cxf/branches/2.6.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java?rev=1559994&r1=1559993&r2=1559994&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java (original) +++ cxf/branches/2.6.x-fixes/rt/core/src/test/java/org/apache/cxf/bus/spring/SpringBusFactoryTest.java Tue Jan 21 12:04:37 2014 @@ -96,6 +96,14 @@ public class SpringBusFactoryTest extend Bus bus = new SpringBusFactory().createBus(cfgFile, true); checkCustomerConfiguration(bus); } + + @Test + public void testCustomerBusShutdown() { + String cfgFile = "org/apache/cxf/bus/spring/customerBus.xml"; + Bus bus = new SpringBusFactory().createBus(cfgFile, true); + // We have three bus here, which should be closed rightly + bus.shutdown(true); + } @Test public void testCustomFileURLFromSystemProperty() {