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 8E85FEACE for ; Wed, 30 Jan 2013 22:03:52 +0000 (UTC) Received: (qmail 62046 invoked by uid 500); 30 Jan 2013 22:03:52 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 61982 invoked by uid 500); 30 Jan 2013 22:03:52 -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 61975 invoked by uid 99); 30 Jan 2013 22:03:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2013 22:03:52 +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, 30 Jan 2013 22:03:51 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4471023889DE; Wed, 30 Jan 2013 22:03:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1440699 - /cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java Date: Wed, 30 Jan 2013 22:03:32 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130130220332.4471023889DE@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dkulp Date: Wed Jan 30 22:03:31 2013 New Revision: 1440699 URL: http://svn.apache.org/viewvc?rev=1440699&view=rev Log: Merged revisions 1440697 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes ........ r1440697 | dkulp | 2013-01-30 17:02:34 -0500 (Wed, 30 Jan 2013) | 10 lines Merged revisions 1440148 via git cherry-pick from https://svn.apache.org/repos/asf/cxf/trunk ........ r1440148 | dkulp | 2013-01-29 16:28:34 -0500 (Tue, 29 Jan 2013) | 2 lines [CXF-4795] Prevent a potential memory leak where the spring bean factory will hold onto string reps of every URL ever used. ........ ........ Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java Modified: cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java?rev=1440699&r1=1440698&r2=1440699&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java (original) +++ cxf/branches/2.6.x-fixes/api/src/main/java/org/apache/cxf/configuration/spring/ConfigurerImpl.java Wed Jan 30 22:03:31 2013 @@ -38,9 +38,11 @@ import org.apache.cxf.common.logging.Log import org.apache.cxf.configuration.Configurable; import org.apache.cxf.configuration.Configurer; import org.apache.cxf.extension.BusExtension; +import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.support.AbstractBeanFactory; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.wiring.BeanConfigurerSupport; import org.springframework.beans.factory.wiring.BeanWiringInfo; @@ -58,6 +60,7 @@ public class ConfigurerImpl extends Bean private Set appContexts; private final Map> wildCardBeanDefinitions = new HashMap>(); + private BeanFactory beanFactory; static class MatcherHolder { Matcher matcher; @@ -76,6 +79,11 @@ public class ConfigurerImpl extends Bean setApplicationContext(ac); } + public void setBeanFactory(BeanFactory beanFactory) { + this.beanFactory = beanFactory; + super.setBeanFactory(beanFactory); + } + private void initWildcardDefinitionMap() { if (null != appContexts) { for (ApplicationContext appContext : appContexts) { @@ -153,6 +161,12 @@ public class ConfigurerImpl extends Bean } try { + //this will prevent a call into the AbstractBeanFactory.markBeanAsCreated(...) + //which saves ALL the names into a HashSet. For URL based configuration, + //this can leak memory + if (beanFactory instanceof AbstractBeanFactory) { + ((AbstractBeanFactory)beanFactory).getMergedBeanDefinition(bn); + } super.configureBean(beanInstance); if (LOG.isLoggable(Level.FINE)) { LOG.fine("Successfully performed injection."); @@ -228,7 +242,8 @@ public class ConfigurerImpl extends Bean public final void setApplicationContext(ApplicationContext ac) { appContexts = new CopyOnWriteArraySet(); addApplicationContext(ac); - setBeanFactory(ac.getAutowireCapableBeanFactory()); + this.beanFactory = ac.getAutowireCapableBeanFactory(); + super.setBeanFactory(this.beanFactory); } public final void addApplicationContext(ApplicationContext ac) {