AMQ-3451: Fixed memory leak when using embedded ActiveMQ broker from Spring XML file. Need to clear a spring cache when stopping.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1382055 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Claus Ibsen 2012-09-07 14:46:45 +00:00
parent aa6a6d73e5
commit 35f15ac8a1
3 changed files with 10 additions and 11 deletions

View File

@ -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;

View File

@ -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;
/**
*

View File

@ -25,6 +25,7 @@ import org.apache.activemq.broker.BrokerService;
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
@ -86,6 +87,12 @@ public class XBeanBrokerService extends BrokerService {
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.