Re: Scheduled task using timer



On Wed, 31 Oct 2007 12:00:42 -0700, cksanjose <cksanjose@xxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :

I have a standalone application that is scheduled to run every 15
minutes. I'm using the Timer class for scheduling. When it starts
running, it checks a table to see if there's any task that is waiting
to be processed. It is possible that one of these tasks will run for
about 3 hours. Does it wait for this task to finish before it checks
again if there's another task to perform? Should I use
"scheduleAtFixedRate" instead of the "schedule" method so that it
checks for a task every 15 minutes regardless if there's a task
running? What I would like is for the application to check every 15
minutes and process any task that is waiting.

Thanks for any help.
Cesar

Timers use a single thread to do all the work, so you can't have
anything on them that takes longer than then time to the next event.
To get around that, your timer event could trigger a background task
that runs in parallel with the timer.

See http://mindprod.com/jgloss/timer.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.



Relevant Pages

  • Re: Full Falcon 1.3 launch video up
    ... :> I'm just a lowly member of the peanut gallery, but everytime I see ... :> someone talking about waiting just a little longer I think about ... :You could solve this with some sort of fancy sensor. ... :complex and prone to failure when compared to a simple timer. ...
    (sci.space.policy)
  • Re: So little time, so much to do!
    ... 15 minute timer when reading my email, etc, bc I lose too much time to ... Which reminds me, I put off scrubbing the sink last night, so I suppose ... Latin could be done while waiting for Art History or Philosophy to start. ...
    (rec.crafts.textiles.needlework)
  • Re: Best option for idle wait
    ... AFAIK there is only one mechanism in windows, ... with a higher resolution than several milliseconds ... and that's the multimedia timer ). ... > cycles and I can't do much else while I am waiting. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: OpenGL driver consumes 100% CPU
    ... One is that the timer may fire while ... you're waiting for the vertical refresh. ...
    (comp.programming.threads)
  • Re: Yet another timers-and-threads question
    ... When the timer expires the virtual function timeout() is called (I ... the idea being to add timeouts to objects of any class running in any ... If your threads are compute-intensive and never waiting -- I believe you can ...
    (microsoft.public.vc.mfc)