You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "shekher.awasthi" <sh...@gmail.com> on 2011/08/30 08:24:29 UTC

Question regarding Using Thread.Sleep()

Hi All,

While working with Camel things are going find but have a doubt about using
Thread.sleep()
I have the following code
public void executeRoute(String routeName) throws Exception{	
    	          resetStatus();
		camelContext.startRoute(routeName);
		Thread.sleep(8000);					
	}

Now its working fine but when i remove Thread.sleep(8000) it seems that
route is not getting executed,
My problem is i am not sure how much time a route can take for e.g if i am
picking things from local file system sleep time will be different and in
case from FTP/HTTP or any other remote call time calculations will be
entirety different

Is there any way to do it in more efficient manner as currently time i am
using to make thread sleep is purely on my assumptions and not with ant
specific calculative way

Thanks in advance
Umesh

--
View this message in context: http://camel.465427.n5.nabble.com/Question-regarding-Using-Thread-Sleep-tp4748986p4748986.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Question regarding Using Thread.Sleep()

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

What is your use case? You want to start a route, and have it do
something and then stop the route? or what

See these FAQs which is a bit related
http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html



On Tue, Aug 30, 2011 at 8:24 AM, shekher.awasthi
<sh...@gmail.com> wrote:
> Hi All,
>
> While working with Camel things are going find but have a doubt about using
> Thread.sleep()
> I have the following code
> public void executeRoute(String routeName) throws Exception{
>                  resetStatus();
>                camelContext.startRoute(routeName);
>                Thread.sleep(8000);
>        }
>
> Now its working fine but when i remove Thread.sleep(8000) it seems that
> route is not getting executed,
> My problem is i am not sure how much time a route can take for e.g if i am
> picking things from local file system sleep time will be different and in
> case from FTP/HTTP or any other remote call time calculations will be
> entirety different
>
> Is there any way to do it in more efficient manner as currently time i am
> using to make thread sleep is purely on my assumptions and not with ant
> specific calculative way
>
> Thanks in advance
> Umesh
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Question-regarding-Using-Thread-Sleep-tp4748986p4748986.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/