Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-390

Jetty threads in CXF consumer preventing application from terminating

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.6.0-fuse-00-00
    • 2.5.0-fuse-00-00
    • None
    • None

    Description

      As mentioned in DEV-2855, when using a CXF Jetty consumer in Camel, the application will never terminate even if you destroy the Spring context. Test case is attached to DEV-2855.

      I found that making the following change to camel-cxf gets around this error:

      janstey@mojo:/x1/asf/camel/trunk/components/camel-cxf$ svn di src/main/java/org/apache/camel/component/cxf/CxfConsumer.java pom.xml
      Index: src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
      ===================================================================
      --- src/main/java/org/apache/camel/component/cxf/CxfConsumer.java	(revision 1050086)
      +++ src/main/java/org/apache/camel/component/cxf/CxfConsumer.java	(working copy)
      @@ -38,6 +38,8 @@
       import org.apache.cxf.message.Message;
       import org.apache.cxf.service.invoker.Invoker;
       import org.apache.cxf.service.model.BindingOperationInfo;
      +import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
      +import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
       import org.apache.cxf.version.Version;
       
       /**
      @@ -263,6 +265,11 @@
           @Override
           protected void doStop() throws Exception {
               server.stop();
      +       
      +        JettyHTTPDestination jettyDest = (JettyHTTPDestination) server.getDestination();
      +        JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine) jettyDest.getEngine();
      +        jettyEngine.shutdown();
      +        
               super.doStop();
           }
           
      Index: pom.xml
      ===================================================================
      --- pom.xml	(revision 1050086)
      +++ pom.xml	(working copy)
      @@ -117,7 +117,7 @@
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-transports-http-jetty</artifactId>
             <version>${cxf-version}</version>
      -      <scope>test</scope>
      +      <scope>compile</scope>
           </dependency>
           
           <dependency>
      

      However, I needed to make camel-cxf depend on cxf-rt-transports-http-jetty which is probably not a good idea. This kind of fix probably belongs in CXF? Here is a related CXF issue https://issues.apache.org/jira/browse/CXF-2775

      Attachments

        Activity

          People

            willem.jiang Willem Jiang (Inactive)
            janstey@redhat.com Jonathan Anstey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: