Did you try to take a thread dump to see what other threads may be
there to hang. Also mind that if you have non-deamon threads then a
JVM cannot terminate so easily without these threads being terminated
first.



On Thu, Sep 19, 2013 at 12:48 AM, Paolo28 <paolo.sa...@gmail.com> wrote:
> I have the same problem.
>
> I have not found any solution to this issue. I believe that Camel should be
> able to shutdown itself in a graceful manner. My scenario:
>
> 1. process N messages (I´m able to detect which is the last)
> 2. once all messages are processed I want to gracefuly terminate the process
> 3. depending on the amount of possible errors I need to return non-zero exit
> status code
>
> What I do:
>
> - from a newly spawned thread I stop the initial route and then whole
> context using camelContext.stop()
> - this new thread dies - it is not hanging
> - I´m using 2.11
>
> Result:
>
> - all the "graceful shutdown stuff" is done (I see log messages) but the
> process is still running
> - I was even able to reliably reproduce weird behaviour: when running with
> INFO log level the camel java process exits as expected, however in case
> DEBUG log level it continues to run forever
> - also trying to connect via JVVM made the hanging process to finish with
> exit status=0 which is also a bit weird
> - except the "stopping thread" I do not create any of my own threads.
>
> I spent 2 days with various approaches and so far was not able to reliably
> stop Camel application.
> I would prefer some standard way - for example via control bus I would like
> to send command to stop everything (there are no more messages anyway). It
> seems like Camel in not really designed with this in mind.
>
>
>
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/After-camelContext-shutdown-is-any-way-to-exit-the-Java-main-method-tp5735993p5739792.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

Reply via email to