camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject camel git commit: CAMEL-10914: Apply the same fix as CxfConsumer to CxfRsConsumer
Date Thu, 02 Mar 2017 08:05:38 GMT
Repository: camel
Updated Branches:
  refs/heads/master b4aff76b4 -> ff5ce55f9


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/ff5ce55f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ff5ce55f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ff5ce55f

Branch: refs/heads/master
Commit: ff5ce55f9e94d72b046f878aa8c4ad3265fd6b39
Parents: b4aff76
Author: Tadayoshi Sato <sato.tadayoshi@gmail.com>
Authored: Thu Mar 2 10:31:57 2017 +0900
Committer: Andrea Cosentino <ancosen@gmail.com>
Committed: Thu Mar 2 08:49:21 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/ff5ce55f/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();
     }
     


Mime
View raw message