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 <syedahmed.c...@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: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen