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:41:34 UTC

svn commit: r1293091 - in /camel/branches/camel-2.8.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:41:33 2012
New Revision: 1293091

URL: http://svn.apache.org/viewvc?rev=1293091&view=rev
Log:
Merged revisions 1293082 via svnmerge from 
https://svn.apache.org/repos/asf/camel/branches/camel-2.9.x

................
  r1293082 | ningjiang | 2012-02-24 13:12:25 +0800 (Fri, 24 Feb 2012) | 9 lines
  
  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.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 24 05:41:33 2012
@@ -1,2 +1,2 @@
-/camel/branches/camel-2.9.x:1227549,1228229,1229567,1234054,1236672,1238942,1240157,1241006,1241489,1243052,1243058,1244875,1244877,1291871,1292116,1292389,1292726,1292769
-/camel/trunk:1226860,1227540,1228223,1229565,1234043,1236667,1238937,1240025,1240950,1240967,1241482,1243046,1243057,1244870,1244872,1291848,1292114,1292384,1292725,1292767
+/camel/branches/camel-2.9.x:1227549,1228229,1229567,1234054,1236672,1238942,1240157,1241006,1241489,1243052,1243058,1244875,1244877,1291871,1292116,1292389,1292726,1292769,1293082
+/camel/trunk:1226860,1227540,1228223,1229565,1234043,1236667,1238937,1240025,1240950,1240967,1241482,1243046,1243057,1244870,1244872,1291848,1292114,1292384,1292725,1292767,1293079

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

Modified: camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=1293091&r1=1293090&r2=1293091&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Fri Feb 24 05:41:33 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.8.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.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java?rev=1293091&r1=1293090&r2=1293091&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java (original)
+++ camel/branches/camel-2.8.x/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/spring/CxfEndpointBeanTest.java Fri Feb 24 05:41:33 2012
@@ -52,6 +52,8 @@ public class CxfEndpointBeanTest extends
     public void testPropertiesSettingOnCxfClient() throws Exception {
         CxfEndpoint clientEndpoint = (CxfEndpoint)ctx.getBean("clientEndpoint");
         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());