cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <>
Subject Question about SpringBus lifecycle
Date Mon, 20 Jan 2014 12:43:48 GMT

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/
+++ b/rt/core/src/main/java/org/apache/cxf/bus/spring/
@@ -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
             } else if (event instanceof ContextClosedEvent) {
-                getExtension(BusLifeCycleManager.class).postShutdown();
+                shutdown();

Is there any thing that I'm missing?

Willem Jiang

Red Hat, Inc.
Blog: (English) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem

View raw message