diff --git a/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java b/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java index 76e5eff5e8..fa0b32520a 100644 --- a/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java +++ b/activemq-core/src/main/java/org/apache/activemq/xbean/BrokerFactoryBean.java @@ -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; diff --git a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java index ab967583cf..4f0111f4c8 100644 --- a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java +++ b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerFactory.java @@ -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; /** * diff --git a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java index 467f5cbc54..557397774d 100644 --- a/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java +++ b/activemq-core/src/main/java/org/apache/activemq/xbean/XBeanBrokerService.java @@ -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 @@ -85,7 +86,13 @@ public class XBeanBrokerService extends BrokerService { 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.