Hi,
I was tracing a CXFBus leak issue recently.
Here are the some details about the application bundle:
It's Spring application context holds a camel context which has a camel-cxf
endpoint to receive the invocation from outside. When the application bundle is
uninstalled from Karaf, the SpringBus doesn’t shutdown itself and CXFBusFactory
doesn’t clean itself up.
If the application bundle is changed to use Blueprint to load the same Camel
context, we don’t find any Bus leak by dump the memory of the JVM.
I dig the SpringBus code and found it registers an ApplicationListener which
handles application context refresh and close event.
My patch is just replacing the
getExtension(BusLifeCycleManager.class).postShutdown(); with bus shutdown().
--- a/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
+++ b/rt/core/src/main/java/org/apache/cxf/bus/spring/SpringBus.java
@@ -21,7 +21,7 @@ package org.apache.cxf.bus.spring;
import org.apache.cxf.bus.BusState;
import org.apache.cxf.bus.extension.ExtensionManagerBus;
-import org.apache.cxf.buslifecycle.BusLifeCycleManager;
import org.apache.cxf.configuration.ConfiguredBeanLocator;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.configuration.spring.ConfigurerImpl;
@@ -110,7 +110,8 @@ public class SpringBus extends ExtensionManagerBus
initialize();
}
} else if (event instanceof ContextClosedEvent) {
- getExtension(BusLifeCycleManager.class).postShutdown();
+ shutdown();
}
}
}
Is there any thing that I'm missing?
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com(http://willemjiang.blogspot.com/)
(English)
http://jnn.iteye.com(http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem