You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2017/03/02 08:04:50 UTC

camel git commit: CAMEL-10914: Apply the same fix as CxfConsumer to CxfRsConsumer

Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 603587300 -> 0d0ac5c39


CAMEL-10914: Apply the same fix as CxfConsumer to CxfRsConsumer


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0d0ac5c3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0d0ac5c3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0d0ac5c3

Branch: refs/heads/camel-2.17.x
Commit: 0d0ac5c391bd7a610f0d7fef7ed3b4cec07e5699
Parents: 6035873
Author: Tadayoshi Sato <sa...@gmail.com>
Authored: Thu Mar 2 10:31:57 2017 +0900
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Thu Mar 2 09:01:39 2017 +0100

----------------------------------------------------------------------
 .../component/cxf/jaxrs/CxfRsConsumer.java      | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/0d0ac5c3/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumer.java
index b2272d0..34949ae 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsConsumer.java
@@ -33,26 +33,38 @@ public class CxfRsConsumer extends DefaultConsumer {
 
     public CxfRsConsumer(CxfRsEndpoint endpoint, Processor processor) {
         super(endpoint, processor);
+        server = createServer();
+    }
+
+    protected Server createServer() {
+        CxfRsEndpoint endpoint = (CxfRsEndpoint) getEndpoint();
         CxfRsInvoker cxfRsInvoker = new CxfRsInvoker(endpoint, this);
         JAXRSServerFactoryBean svrBean = endpoint.createJAXRSServerFactoryBean();
-        Bus bus = ((CxfRsEndpoint)getEndpoint()).getBus();
-        // We need to apply the bus setting from the CxfRsEndpoint which is not use the default bus
+        Bus bus = endpoint.getBus();
+        // We need to apply the bus setting from the CxfRsEndpoint which does not use the default bus
         if (bus != null) {
             svrBean.setBus(bus);
         }
         svrBean.setInvoker(cxfRsInvoker);
-        server = svrBean.create();
+        return svrBean.create();
     }
-    
+
     @Override
     protected void doStart() throws Exception {
         super.doStart();
+        if (server == null) {
+            server = createServer();
+        }
         server.start();
     }
 
     @Override
     protected void doStop() throws Exception {
-        server.stop();
+        if (server != null) {
+            server.stop();
+            server.destroy();
+            server = null;
+        }
         super.doStop();
     }