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 74E4E9667 for ; Wed, 15 Feb 2012 19:21:43 +0000 (UTC) Received: (qmail 35376 invoked by uid 500); 15 Feb 2012 19:21:43 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 35308 invoked by uid 500); 15 Feb 2012 19:21:43 -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 35301 invoked by uid 99); 15 Feb 2012 19:21:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Feb 2012 19:21:43 +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; Wed, 15 Feb 2012 19:21:42 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 04F532388ACC; Wed, 15 Feb 2012 19:21:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1244663 - in /cxf/branches/2.5.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/bus/spring/ systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/ Date: Wed, 15 Feb 2012 19:21:21 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120215192122.04F532388ACC@eris.apache.org> Author: dkulp Date: Wed Feb 15 19:21:21 2012 New Revision: 1244663 URL: http://svn.apache.org/viewvc?rev=1244663&view=rev Log: Merged revisions 1244652 via svn merge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1244652 | dkulp | 2012-02-15 14:13:05 -0500 (Wed, 15 Feb 2012) | 1 line [CXF-4094] Put a guard around the closing of the context. ........ Added: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/basic.xml - copied unchanged from r1244652, cxf/trunk/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/basic.xml Modified: cxf/branches/2.5.x-fixes/ (props changed) cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java Propchange: cxf/branches/2.5.x-fixes/ ('svn:mergeinfo' removed) Propchange: cxf/branches/2.5.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java?rev=1244663&r1=1244662&r2=1244663&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java (original) +++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java Wed Feb 15 19:21:21 2012 @@ -47,7 +47,7 @@ public class SpringBus extends Extension implements ApplicationContextAware, ApplicationListener { AbstractApplicationContext ctx; - + boolean closeContext; public SpringBus() { } @@ -115,7 +115,6 @@ public class SpringBus extends Extension } ac = ac.getParent(); } - if (doIt) { if (event instanceof ContextRefreshedEvent) { if (getState() != BusState.RUNNING) { @@ -128,7 +127,9 @@ public class SpringBus extends Extension } public void destroyBeans() { - ctx.close(); + if (closeContext) { + ctx.close(); + } super.destroyBeans(); } @@ -148,4 +149,8 @@ public class SpringBus extends Extension return id; } + public void setCloseContext(boolean b) { + closeContext = b; + } + } Modified: cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java?rev=1244663&r1=1244662&r2=1244663&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java (original) +++ cxf/branches/2.5.x-fixes/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBusFactory.java Wed Feb 15 19:21:21 2012 @@ -83,6 +83,10 @@ public class SpringBusFactory extends Bu initializeBus(bus); registerApplicationContextLifeCycleListener(bus, bac); + + if (bus instanceof SpringBus && defaultBusNotExists()) { + ((SpringBus)bus).setCloseContext(true); + } return bus; } Modified: cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java?rev=1244663&r1=1244662&r2=1244663&view=diff ============================================================================== --- cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java (original) +++ cxf/branches/2.5.x-fixes/systests/uncategorized/src/test/java/org/apache/cxf/systest/bus/SpringBusFactoryTest.java Wed Feb 15 19:21:21 2012 @@ -64,6 +64,19 @@ public class SpringBusFactoryTest extend checkBindingExtensions(bus); checkHTTPTransportFactories(bus); checkOtherCoreExtensions(bus); + ctx.destroy(); + } + @Test + public void testLoadBusWithApplicationContext() throws BusException { + ClassPathXmlApplicationContext ctx = + new ClassPathXmlApplicationContext(new String[] {"/org/apache/cxf/systest/bus/basic.xml"}); + Bus bus = ctx.getBean("cxf", Bus.class); + ctx.refresh(); + bus = ctx.getBean("cxf", Bus.class); + checkBindingExtensions(bus); + checkHTTPTransportFactories(bus); + checkOtherCoreExtensions(bus); + ctx.destroy(); } private void checkBindingExtensions(Bus bus) throws BusException {