You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2009/06/11 14:45:55 UTC
svn commit: r783745 - in /camel/branches/camel-1.x/components/camel-cxf/src:
main/java/org/apache/camel/component/cxf/spring/
test/java/org/apache/camel/component/cxf/spring/
Author: ningjiang
Date: Thu Jun 11 12:45:55 2009
New Revision: 783745
URL: http://svn.apache.org/viewvc?rev=783745&view=rev
Log:
CAMEL-1696 clean up the BusFactory when the ApplicationContext is closed
Modified:
camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java?rev=783745&r1=783744&r2=783745&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBean.java Thu Jun 11 12:45:55 2009
@@ -19,13 +19,16 @@
import java.util.List;
+import org.apache.cxf.BusFactory;
import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
+import org.springframework.beans.factory.DisposableBean;
/**
*
*/
-public class CxfEndpointBean extends AbstractWSDLBasedEndpointFactory {
+public class CxfEndpointBean extends AbstractWSDLBasedEndpointFactory
+ implements DisposableBean {
private List handlers;
public CxfEndpointBean() {
@@ -43,4 +46,10 @@
public void setHandlers(List handlers) {
this.handlers = handlers;
}
+
+ public void destroy() throws Exception {
+ // Clean up the BusFactory's defaultBus
+ BusFactory.setDefaultBus(null);
+ BusFactory.setThreadDefaultBus(null);
+ }
}
Modified: camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java?rev=783745&r1=783744&r2=783745&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanDefinitionParser.java Thu Jun 11 12:45:55 2009
@@ -110,16 +110,10 @@
public void setApplicationContext(ApplicationContext ctx) throws BeansException {
if (getBus() == null) {
- Bus bus = BusFactory.getDefaultBus();
- // check the application status first, just update the bus reference in an active application Context
- if (ctx instanceof ConfigurableApplicationContext) {
- if (((ConfigurableApplicationContext)ctx).isActive()) {
- BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(getBus(), ctx);
- }
- }
+ Bus bus = BusFactory.getDefaultBus();
setBus(bus);
}
-
+ BusWiringBeanFactoryPostProcessor.updateBusReferencesInContext(getBus(), ctx);
}
}
Modified: camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=783745&r1=783744&r2=783745&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ camel/branches/camel-1.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Thu Jun 11 12:45:55 2009
@@ -37,8 +37,7 @@
}
protected void tearDown() throws Exception {
- ctx.close();
- BusFactory.setDefaultBus(null);
+ ctx.close();
}
public void testCxfEndpointBeanDefinitionParser() {