camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Need control back in the Main routine so that we can terminate JVM
Date Mon, 13 Jun 2011 15:51:20 GMT
On Mon, Jun 13, 2011 at 5:25 PM, AnujK <> wrote:
> Thanks Claus.
> -Yes, I did follow that example, and am calling
> "System.out.println("Starting Camel. Use ctrl + c to terminate the JVM.\n");
> The problem is ' the main just keeps on running' - which we don't want.
> However, I need to terminate my VM when the FTP route is complete.
> I can stop/start the routes programatically, but is there a way to signal to
> the main thread, that routes have stopped, and you can now terminate.
> In essence, I do not need to be running 'forever'.

You can have for example a static boolean on the Main class, and then
change that when the route is done.

Then in the Main thread you loop and check that boolean and stop if its changed.
Remember to use sleep in the while loop so you dont loop too often and
drain CPU cycles.

Its frankly a general problem, so you can google for ideas.

> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message