Re: Java Timer
- From: Roedy Green <my_email_is_posted_on_my_website@xxxxxxxxxxxxxx>
- Date: Wed, 30 Nov 2005 06:29:23 GMT
On 29 Nov 2005 19:45:39 -0800, "sconeek" <sconeek@xxxxxxxxx> wrote,
quoted or indirectly quoted someone who said :
>I am writing a Java app, where I need to wait for 10 seconds after a
>condition holds good and then check if the same condition still holds
>true and if yes then do something.
>
>Essentially I have this,
> if (mDt.getTime() == lsEtTSt.getTime()) {
> // wait for 10 seconds
>
> // check for the condition again
>
> // Do something
> }
>
>I dont want to use Thread.sleep. If somebody could suggest a loop or
>something which goes on for 10seconds that would be really great.
why not sleep? if you have only one test.
The alternative is to use a Timer that get triggered every 10 seconds.
The advantage here is you can use the same Timer thread to manage
several different periodic tests. See
http://mindprod.com/jgloss/timer.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
.
- References:
- Java Timer
- From: sconeek
- Java Timer
- Prev by Date: Re: Java Timer
- Next by Date: Re: passing bean to a java function in jsp scriplet
- Previous by thread: Re: Java Timer
- Next by thread: Rethrowing an exception via JNI ?
- Index(es):
Relevant Pages
|