You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by SyedBhai <sy...@hotmail.com> on 2013/07/26 11:06:12 UTC

Is it Camel Bug?

Hi Camel Community,
  I am having a web application project.
  For every incoming request I am creating a thread that fulfills the
request.  For fulfilling the request the thread uses Camel Framework to
communicate with the external entities such as Servlets, WebServices, etc.
  The problem I am facing is Camel is creating some internal threads and
these internal threads are not getting closed.  I am getting Severe Warnings
in the tomcat log file stating that the threads were not closed.
  To prove my point, I wrote a simple java program.  The main() method is:
  public static void main(String str[]) {
        try {
            CamelContext cc = new DefaultCamelContext();
            cc.addRoutes(new RouteBuilder() {
                public void configure() {
                    from("direct:start1").
                           
to("cxf://http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort"); 
// 
                }
            });

            cc.start();
            ProducerTemplate t = cc.createProducerTemplate();
            int annsal = t.requestBody("direct:start1", 10000,
Integer.class);
            System.out.println("annsal:" + annsal);
            //cc.getShutdownStrategy().setTimeUnit(TimeUnit.SECONDS);
            //cc.getShutdownStrategy().setTimeout(1);
            t.stop();
            cc.stop();
            //cc.getShutdownStrategy().setShutdownNowOnTimeout(true);
            //Thread.sleep(3000);
        } catch (Exception i) {
            i.printStackTrace();
        }
    }
}

  To my surpise even after the main() is finished, the application is still
running.  It did not stop even after atleast 10 minutes.  I wanted to find
out what threads are running.
  This is the list of threads I got.
Thread[I/O dispatcher 2,5,main]
Thread[I/O dispatcher 3,5,main]
Thread[I/O dispatcher 4,5,main]
Thread[main,5,main]
Thread[Finalizer,8,system]
Thread[Reference Handler,10,system]
Thread[Signal Dispatcher,9,system]
Thread[default-workqueue-1,5,default-workqueue]
Thread[GC Daemon,2,system]
Thread[I/O dispatcher 1,5,main]
Thread[Thread-1,5,main]

  With this, I am concluding there is a bug in Camel Framework or there is a
bug in the utilities that Camel is using such as CXF, etc.

  I am worried if this will cause memory leaks in my project.
  
  Can the camel experts help me please?

Thanks,
Syed.
  
  



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by James Carman <jc...@carmanconsulting.com>.
We see the same messages you do in our Tomcat logs.  However, Tomcat shuts down just fine and there are no memory leaks.  Now, we don't stop/start the web application all the time using the manager, though.  In production, we usually shut the entire Tomcat instance down and bring it back up once we've fixed what we are fixing.


On Jul 26, 2013, at 7:15 AM, SyedBhai <sy...@hotmail.com> wrote:

> Nope.
> Sir, mine is a web application.  If I call System.exit() tomcat server will
> shutdown.
> 
> Syed.
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736292.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Is it Camel Bug?

Posted by SyedBhai <sy...@hotmail.com>.
Nope.
Sir, mine is a web application.  If I call System.exit() tomcat server will
shutdown.

Syed.



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736292.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by Bart Horré <ba...@anova.be>.
Could a system.exit at the end of the main perhaps solve your problem?


On Fri, Jul 26, 2013 at 11:06 AM, SyedBhai <sy...@hotmail.com>wrote:

> Hi Camel Community,
>   I am having a web application project.
>   For every incoming request I am creating a thread that fulfills the
> request.  For fulfilling the request the thread uses Camel Framework to
> communicate with the external entities such as Servlets, WebServices, etc.
>   The problem I am facing is Camel is creating some internal threads and
> these internal threads are not getting closed.  I am getting Severe
> Warnings
> in the tomcat log file stating that the threads were not closed.
>   To prove my point, I wrote a simple java program.  The main() method is:
>   public static void main(String str[]) {
>         try {
>             CamelContext cc = new DefaultCamelContext();
>             cc.addRoutes(new RouteBuilder() {
>                 public void configure() {
>                     from("direct:start1").
>
> to("cxf://
> http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort
> ");
> //
>                 }
>             });
>
>             cc.start();
>             ProducerTemplate t = cc.createProducerTemplate();
>             int annsal = t.requestBody("direct:start1", 10000,
> Integer.class);
>             System.out.println("annsal:" + annsal);
>             //cc.getShutdownStrategy().setTimeUnit(TimeUnit.SECONDS);
>             //cc.getShutdownStrategy().setTimeout(1);
>             t.stop();
>             cc.stop();
>             //cc.getShutdownStrategy().setShutdownNowOnTimeout(true);
>             //Thread.sleep(3000);
>         } catch (Exception i) {
>             i.printStackTrace();
>         }
>     }
> }
>
>   To my surpise even after the main() is finished, the application is still
> running.  It did not stop even after atleast 10 minutes.  I wanted to find
> out what threads are running.
>   This is the list of threads I got.
> Thread[I/O dispatcher 2,5,main]
> Thread[I/O dispatcher 3,5,main]
> Thread[I/O dispatcher 4,5,main]
> Thread[main,5,main]
> Thread[Finalizer,8,system]
> Thread[Reference Handler,10,system]
> Thread[Signal Dispatcher,9,system]
> Thread[default-workqueue-1,5,default-workqueue]
> Thread[GC Daemon,2,system]
> Thread[I/O dispatcher 1,5,main]
> Thread[Thread-1,5,main]
>
>   With this, I am concluding there is a bug in Camel Framework or there is
> a
> bug in the utilities that Camel is using such as CXF, etc.
>
>   I am worried if this will cause memory leaks in my project.
>
>   Can the camel experts help me please?
>
> Thanks,
> Syed.
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Bart Horré
Anova r&d bvba

Re: Is it Camel Bug?

Posted by Christian Müller <ch...@gmail.com>.
It sounds really strange to me...
How do you bootstrap Camel in you web application? Can you share your code?
Hopefully, you do not create a new Camel context per (web) request...

Best,
Christian
-----------------

Software Integration Specialist

Apache Camel committer: https://camel.apache.org/team
V.P. Apache Camel: https://www.apache.org/foundation/
Apache Member: https://www.apache.org/foundation/members.html

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Sun, Jul 28, 2013 at 7:56 PM, SyedBhai <sy...@hotmail.com>wrote:

> Sir,
>   The question here is not about web application or standalone application.
> The question is camel is creating some threads.  These threads are not
> getting terminated at all.
>   I am having a web application.  For every incoming request I create a
> thread to process the request.  This thread uses camel framework.  Because
> of camel the thread is not getting terminated.  Because internally camel is
> creating more threads which keep running ever.
>   To prove my point I copied that camel code and run it as a standalone
> application using main().  And even after main() finishes the program is
> still running.
>   I have thus proved my point that camel is creating some threads which do
> not terminate at all.
>   So I wanted to know if the bug is in camel or the components used by
> camel
> such as cxf, etc.
>
> Thanks,
> Syed.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736372.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Is it Camel Bug?

Posted by James Carman <ja...@carmanconsulting.com>.
When you say "web application", are we talking about the normal,
servlet-based kind?  If so, why are you creating threads yourself?
How are you "bootstrapping" Camel in your web application?  Are you
following the directions outlined in the tutorial Claus showed you?

On Sun, Jul 28, 2013 at 1:56 PM, SyedBhai <sy...@hotmail.com> wrote:
> Sir,
>   The question here is not about web application or standalone application.
> The question is camel is creating some threads.  These threads are not
> getting terminated at all.
>   I am having a web application.  For every incoming request I create a
> thread to process the request.  This thread uses camel framework.  Because
> of camel the thread is not getting terminated.  Because internally camel is
> creating more threads which keep running ever.
>   To prove my point I copied that camel code and run it as a standalone
> application using main().  And even after main() finishes the program is
> still running.
>   I have thus proved my point that camel is creating some threads which do
> not terminate at all.
>   So I wanted to know if the bug is in camel or the components used by camel
> such as cxf, etc.
>
> Thanks,
> Syed.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736372.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by Taariq Levack <ta...@gmail.com>.
Syed, if you post your actual code and config we will likely see some
misuse or misconfiguration.
Its not typical to create threads in a web application, especially not for
every request.
And it's not typical to start/stop the producer or the camel context for
each request.

Taariq


On Mon, Jul 29, 2013 at 7:41 AM, SyedBhai <sy...@hotmail.com>wrote:

> Hello everyone.
>   Please.  Try to understand my problem.
>   Lets forget about web application or standalone application or tomcat.
>
>   The problem is very simple.  I have a WSDL based webservice.  I want to
> invoke this service using Camel and get the results.
>
>   The code for doing this is here.
>
>    public class Run {
>
>     public static void main(String str[]) {
>         try {
>             CamelContext cc = new DefaultCamelContext();
>             cc.addRoutes(new RouteBuilder() {
>                 public void configure() {
>                     from("direct:start1").
>
> to("cxf://
> http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort
> ");
>                 }
>             });
>
>             cc.start();
>             ProducerTemplate t = cc.createProducerTemplate();
>             int annsal = t.requestBody("direct:start1", 10000,
> Integer.class);
>             System.out.println("annsal:" + annsal);
>             t.stop();
>             cc.stop();
>         } catch (Exception i) {
>             i.printStackTrace();
>         }
>   }
> }
>
>   When I run the above program I am able to get the results.  But the
> program is still running.  Even though I shutdown template first followed
> by
> context the program is still running.
>
>   I wanted to print the list of threads that are running.  The list of
> threads is available in my first message.
>
>   With this I concluded there is a bug in camel.  Camel is creating some
> threads and not stopping them.  Or the bug could be with utilities used by
> camel such as CXF, etc.
>
>   I have similar piece of code in my web application.  Because the
> standalone program is not terminating my thread in web application is also
> not terminating.
>
>   Can you guys just help me how to gracefully shut down the camel in the
> above piece of code.
>
>   Please do not suggest System.exit().  That will not help me.
>
> Thanks,
> Syed.
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736391.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Is it Camel Bug?

Posted by James Carman <ja...@carmanconsulting.com>.
Well, you said all you needed to do was call a web service.  If that's
all you need, Camel is overkill.  Now, if you have other points of
integration, sure Camel's the right choice.

On Mon, Jul 29, 2013 at 2:48 PM, SyedBhai <sy...@hotmail.com> wrote:
> Sir,
>   You asked "why do you need camel at all"?
>   The answer is firstly I know camel not cxf.
>   Secondly I need to communicate with external programs which could be tcp
> services, udp services, web services, servlets, etc.
>   So using camel I can write uniform code to communicate with all the above
> mentioned programs.
>   Do you have any more questions?
>
> Thanks,
> Syed.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736447.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by SyedBhai <sy...@hotmail.com>.
Sir,
  You asked "why do you need camel at all"?
  The answer is firstly I know camel not cxf.
  Secondly I need to communicate with external programs which could be tcp
services, udp services, web services, servlets, etc.
  So using camel I can write uniform code to communicate with all the above
mentioned programs.
  Do you have any more questions?

Thanks,
Syed.



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736447.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by James Carman <ja...@carmanconsulting.com>.
Why do you need Camel here at all?  If you're just calling a web service,
that's simple enough using just cxf.

On Monday, July 29, 2013, SyedBhai wrote:

> Hello Willem,
>   Yes.  This is what I wanted.
>   When I add the option "synchronous=true" it shutsdown gracefully
> immediately.
>
> Thanks,
> Syed.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736399.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Is it Camel Bug?

Posted by SyedBhai <sy...@hotmail.com>.
Hello Willem,
  Yes.  This is what I wanted.
  When I add the option "synchronous=true" it shutsdown gracefully
immediately.

Thanks,
Syed.



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736399.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by Willem jiang <wi...@gmail.com>.
Hi

I can give you some explain about the default-workqueue thread pool.

Thread[default-workqueue-1,5,default-workqueue]

As camel-cxf producer is using the async invocation by default, the default-workqueue is used for handle the request in other thread, when the camel context is stopped, it doesn't shutdown the default-workqueue. It's bug of camel-cxf, I just fill a JIRA[1] for it.

You should work around it by setting the option of synchronous to be true in camel-cxf endpoint uri.

[1]https://issues.apache.org/jira/browse/CAMEL-6585

Willem  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, July 29, 2013 at 1:41 PM, SyedBhai wrote:

> Hello everyone.
> Please. Try to understand my problem.
> Lets forget about web application or standalone application or tomcat.
>  
> The problem is very simple. I have a WSDL based webservice. I want to
> invoke this service using Camel and get the results.
>  
> The code for doing this is here.
>  
> public class Run {
>  
> public static void main(String str[]) {
> try {
> CamelContext cc = new DefaultCamelContext();
> cc.addRoutes(new RouteBuilder() {
> public void configure() {
> from("direct:start1").
>  
> to("cxf://http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort");  
> }
> });
>  
> cc.start();
> ProducerTemplate t = cc.createProducerTemplate();
> int annsal = t.requestBody("direct:start1", 10000,
> Integer.class);
> System.out.println("annsal:" + annsal);
> t.stop();
> cc.stop();  
> } catch (Exception i) {
> i.printStackTrace();
> }
> }
> }
>  
> When I run the above program I am able to get the results. But the
> program is still running. Even though I shutdown template first followed by
> context the program is still running.
>  
> I wanted to print the list of threads that are running. The list of
> threads is available in my first message.
>  
> With this I concluded there is a bug in camel. Camel is creating some
> threads and not stopping them. Or the bug could be with utilities used by
> camel such as CXF, etc.
>  
> I have similar piece of code in my web application. Because the
> standalone program is not terminating my thread in web application is also
> not terminating.
>  
> Can you guys just help me how to gracefully shut down the camel in the
> above piece of code.
>  
> Please do not suggest System.exit(). That will not help me.
>  
> Thanks,
> Syed.
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736391.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Is it Camel Bug?

Posted by SyedBhai <sy...@hotmail.com>.
Hello everyone.
  Please.  Try to understand my problem.
  Lets forget about web application or standalone application or tomcat.

  The problem is very simple.  I have a WSDL based webservice.  I want to
invoke this service using Camel and get the results.

  The code for doing this is here.

   public class Run {

    public static void main(String str[]) {
        try {
            CamelContext cc = new DefaultCamelContext();
            cc.addRoutes(new RouteBuilder() {
                public void configure() {
                    from("direct:start1").
                           
to("cxf://http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort");  
                }
            });

            cc.start();
            ProducerTemplate t = cc.createProducerTemplate();
            int annsal = t.requestBody("direct:start1", 10000,
Integer.class);
            System.out.println("annsal:" + annsal);
            t.stop();
            cc.stop();            
        } catch (Exception i) {
            i.printStackTrace();
        }
  }
}

  When I run the above program I am able to get the results.  But the
program is still running.  Even though I shutdown template first followed by
context the program is still running.

  I wanted to print the list of threads that are running.  The list of
threads is available in my first message.

  With this I concluded there is a bug in camel.  Camel is creating some
threads and not stopping them.  Or the bug could be with utilities used by
camel such as CXF, etc.

  I have similar piece of code in my web application.  Because the
standalone program is not terminating my thread in web application is also
not terminating.

  Can you guys just help me how to gracefully shut down the camel in the
above piece of code.
  
  Please do not suggest System.exit().  That will not help me.

Thanks,
Syed.
  



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736391.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by Willem jiang <wi...@gmail.com>.
Are you using Camel ProducerTemplate to send the request to the camel context?
If so , you need to stop it first.

BTW, it will be helpful if you can show us what's the process thread do.  

--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Monday, July 29, 2013 at 1:56 AM, SyedBhai wrote:

> Sir,
> The question here is not about web application or standalone application.  
> The question is camel is creating some threads. These threads are not
> getting terminated at all.
> I am having a web application. For every incoming request I create a
> thread to process the request. This thread uses camel framework. Because
> of camel the thread is not getting terminated. Because internally camel is
> creating more threads which keep running ever.
> To prove my point I copied that camel code and run it as a standalone
> application using main(). And even after main() finishes the program is
> still running.
> I have thus proved my point that camel is creating some threads which do
> not terminate at all.
> So I wanted to know if the bug is in camel or the components used by camel
> such as cxf, etc.
>  
> Thanks,
> Syed.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736372.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Is it Camel Bug?

Posted by SyedBhai <sy...@hotmail.com>.
Sir,
  The question here is not about web application or standalone application. 
The question is camel is creating some threads.  These threads are not
getting terminated at all.
  I am having a web application.  For every incoming request I create a
thread to process the request.  This thread uses camel framework.  Because
of camel the thread is not getting terminated.  Because internally camel is
creating more threads which keep running ever.
  To prove my point I copied that camel code and run it as a standalone
application using main().  And even after main() finishes the program is
still running.
  I have thus proved my point that camel is creating some threads which do
not terminate at all.
  So I wanted to know if the bug is in camel or the components used by camel
such as cxf, etc.

Thanks,
Syed.



--
View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288p5736372.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Is it Camel Bug?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

For a web application in Tomcat see this page for how to do that properly
http://camel.apache.org/tutorial-on-using-camel-in-a-web-application.html

You write a standalone app with a main method, this is not the way you
should do that.


On Fri, Jul 26, 2013 at 11:06 AM, SyedBhai <sy...@hotmail.com> wrote:
> Hi Camel Community,
>   I am having a web application project.
>   For every incoming request I am creating a thread that fulfills the
> request.  For fulfilling the request the thread uses Camel Framework to
> communicate with the external entities such as Servlets, WebServices, etc.
>   The problem I am facing is Camel is creating some internal threads and
> these internal threads are not getting closed.  I am getting Severe Warnings
> in the tomcat log file stating that the threads were not closed.
>   To prove my point, I wrote a simple java program.  The main() method is:
>   public static void main(String str[]) {
>         try {
>             CamelContext cc = new DefaultCamelContext();
>             cc.addRoutes(new RouteBuilder() {
>                 public void configure() {
>                     from("direct:start1").
>
> to("cxf://http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort");
> //
>                 }
>             });
>
>             cc.start();
>             ProducerTemplate t = cc.createProducerTemplate();
>             int annsal = t.requestBody("direct:start1", 10000,
> Integer.class);
>             System.out.println("annsal:" + annsal);
>             //cc.getShutdownStrategy().setTimeUnit(TimeUnit.SECONDS);
>             //cc.getShutdownStrategy().setTimeout(1);
>             t.stop();
>             cc.stop();
>             //cc.getShutdownStrategy().setShutdownNowOnTimeout(true);
>             //Thread.sleep(3000);
>         } catch (Exception i) {
>             i.printStackTrace();
>         }
>     }
> }
>
>   To my surpise even after the main() is finished, the application is still
> running.  It did not stop even after atleast 10 minutes.  I wanted to find
> out what threads are running.
>   This is the list of threads I got.
> Thread[I/O dispatcher 2,5,main]
> Thread[I/O dispatcher 3,5,main]
> Thread[I/O dispatcher 4,5,main]
> Thread[main,5,main]
> Thread[Finalizer,8,system]
> Thread[Reference Handler,10,system]
> Thread[Signal Dispatcher,9,system]
> Thread[default-workqueue-1,5,default-workqueue]
> Thread[GC Daemon,2,system]
> Thread[I/O dispatcher 1,5,main]
> Thread[Thread-1,5,main]
>
>   With this, I am concluding there is a bug in Camel Framework or there is a
> bug in the utilities that Camel is using such as CXF, etc.
>
>   I am worried if this will cause memory leaks in my project.
>
>   Can the camel experts help me please?
>
> Thanks,
> Syed.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Is it Camel Bug?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

This is already discussed here.
http://camel.465427.n5.nabble.com/After-camelContext-shutdown-is-any-way-to-exit-the-Java-main-method-tp5735993.html

On Fri, Jul 26, 2013 at 11:06 AM, SyedBhai <sy...@hotmail.com> wrote:
> Hi Camel Community,
>   I am having a web application project.
>   For every incoming request I am creating a thread that fulfills the
> request.  For fulfilling the request the thread uses Camel Framework to
> communicate with the external entities such as Servlets, WebServices, etc.
>   The problem I am facing is Camel is creating some internal threads and
> these internal threads are not getting closed.  I am getting Severe Warnings
> in the tomcat log file stating that the threads were not closed.
>   To prove my point, I wrote a simple java program.  The main() method is:
>   public static void main(String str[]) {
>         try {
>             CamelContext cc = new DefaultCamelContext();
>             cc.addRoutes(new RouteBuilder() {
>                 public void configure() {
>                     from("direct:start1").
>
> to("cxf://http://localhost:8080/JAXWS1/MyInterfaceImpl?serviceClass=com.syed.MyInterface&serviceName={http://syed.com/}MyInterfaceImplService&portName={http://syed.com/}MyInterfaceImplPort");
> //
>                 }
>             });
>
>             cc.start();
>             ProducerTemplate t = cc.createProducerTemplate();
>             int annsal = t.requestBody("direct:start1", 10000,
> Integer.class);
>             System.out.println("annsal:" + annsal);
>             //cc.getShutdownStrategy().setTimeUnit(TimeUnit.SECONDS);
>             //cc.getShutdownStrategy().setTimeout(1);
>             t.stop();
>             cc.stop();
>             //cc.getShutdownStrategy().setShutdownNowOnTimeout(true);
>             //Thread.sleep(3000);
>         } catch (Exception i) {
>             i.printStackTrace();
>         }
>     }
> }
>
>   To my surpise even after the main() is finished, the application is still
> running.  It did not stop even after atleast 10 minutes.  I wanted to find
> out what threads are running.
>   This is the list of threads I got.
> Thread[I/O dispatcher 2,5,main]
> Thread[I/O dispatcher 3,5,main]
> Thread[I/O dispatcher 4,5,main]
> Thread[main,5,main]
> Thread[Finalizer,8,system]
> Thread[Reference Handler,10,system]
> Thread[Signal Dispatcher,9,system]
> Thread[default-workqueue-1,5,default-workqueue]
> Thread[GC Daemon,2,system]
> Thread[I/O dispatcher 1,5,main]
> Thread[Thread-1,5,main]
>
>   With this, I am concluding there is a bug in Camel Framework or there is a
> bug in the utilities that Camel is using such as CXF, etc.
>
>   I am worried if this will cause memory leaks in my project.
>
>   Can the camel experts help me please?
>
> Thanks,
> Syed.
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-it-Camel-Bug-tp5736288.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen