activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1382055 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean: BrokerFactoryBean.java XBeanBrokerFactory.java XBeanBrokerService.java
Date Fri, 07 Sep 2012 14:46:45 GMT
Author: davsclaus
Date: Fri Sep  7 14:46:45 2012
New Revision: 1382055

URL: http://svn.apache.org/viewvc?rev=1382055&view=rev
Log:
AMQ-3451: Fixed memory leak when using embedded ActiveMQ broker from Spring XML file. Need
to clear a spring cache when stopping.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java?rev=1382055&r1=1382054&r2=1382055&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java
Fri Sep  7 14:46:45 2012
@@ -20,8 +20,6 @@ import java.beans.PropertyEditorManager;
 import java.net.URI;
 
 import org.apache.activemq.broker.BrokerService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.xbean.spring.context.ResourceXmlApplicationContext;
 import org.apache.xbean.spring.context.impl.URIEditor;
 import org.springframework.beans.BeansException;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java?rev=1382055&r1=1382054&r2=1382055&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java
Fri Sep  7 14:46:45 2012
@@ -17,30 +17,24 @@
 package org.apache.activemq.xbean;
 
 import java.beans.PropertyEditorManager;
-import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URI;
-import java.util.Map;
 
 import org.apache.activemq.broker.BrokerFactoryHandler;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.spring.Utils;
 import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.util.URISupport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.xbean.spring.context.ResourceXmlApplicationContext;
 import org.apache.xbean.spring.context.impl.URIEditor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.FatalBeanException;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.FileSystemResource;
 import org.springframework.core.io.Resource;
-import org.springframework.core.io.UrlResource;
-import org.springframework.util.ResourceUtils;
 
 /**
  * 

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=1382055&r1=1382054&r2=1382055&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
Fri Sep  7 14:46:45 2012
@@ -25,6 +25,7 @@ import org.apache.activemq.broker.Broker
 import org.apache.activemq.usage.SystemUsage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.CachedIntrospectionResults;
 
 /**
  * An ActiveMQ Message Broker. It consists of a number of transport
@@ -85,7 +86,13 @@ public class XBeanBrokerService extends 
     public void destroy() throws Exception {
         stop();
     }
-    
+
+    @Override
+    public void stop() throws Exception {
+        // must clear this Spring cache to avoid any memory leaks
+        CachedIntrospectionResults.clearClassLoader(getClass().getClassLoader());
+        super.stop();
+    }
 
     /**
      * Sets whether or not the broker is started along with the ApplicationContext it is
defined within.



Mime
View raw message