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 2012/02/24 06:12:26 UTC

svn commit: r1293082 - in /camel/branches/camel-2.9.x: ./ components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java

Author: ningjiang
Date: Fri Feb 24 05:12:25 2012
New Revision: 1293082

URL: http://svn.apache.org/viewvc?rev=1293082&view=rev
Log:
Merged revisions 1293079 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1293079 | ningjiang | 2012-02-24 13:01:47 +0800 (Fri, 24 Feb 2012) | 1 line
  
  CAMEL-5035 CxfProducer should release the CXF client when the producer is stopped
........

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 24 05:12:25 2012
@@ -1 +1 @@
-/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864,1292114,1292384,1292725,1292760,1292767
+/camel/trunk:1243046,1243057,1243234,1244518,1244644,1244859,1244861,1244864,1244870,1244872,1245021,1291555,1291727,1291848,1291864,1292114,1292384,1292725,1292760,1292767,1293079

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=1293082&r1=1293081&r2=1293082&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Fri Feb 24 05:12:25 2012
@@ -69,7 +69,23 @@ public class CxfProducer extends Default
     public CxfProducer(CxfEndpoint endpoint) throws Exception {
         super(endpoint);
         this.endpoint = endpoint;
-        client = endpoint.createClient();
+    }
+    
+    @Override
+    protected void doStart() throws Exception {
+        if (client == null) {
+            client = endpoint.createClient();
+        }
+    }
+    
+    @Override
+    protected void doStop() throws Exception {
+        super.doStop();
+        if (client != null) {
+            // It will help to release the request context map
+            client.destroy();
+            client = null;
+        }
     }
    
     // As the cxf client async and sync api is implement different,

Modified: camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=1293082&r1=1293081&r2=1293082&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ camel/branches/camel-2.9.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Fri Feb 24 05:12:25 2012
@@ -71,6 +71,8 @@ public class CxfEndpointBeanTest extends
     public void testPropertiesSettingOnCxfClient() throws Exception {
         CxfEndpoint clientEndpoint = ctx.getBean("clientEndpoint", CxfEndpoint.class);
         CxfProducer producer = (CxfProducer) clientEndpoint.createProducer();
+        // need to start the producer to get the client
+        producer.start();
         Client client = producer.getClient();
         HTTPConduit conduit = (HTTPConduit)client.getConduit();
         assertEquals("Got the wrong user name", "test", conduit.getAuthorization().getUserName());