Re: Scheduled task using timer
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 20:40:17 GMT
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
.
- References:
- Scheduled task using timer
- From: cksanjose
- Scheduled task using timer
- Prev by Date: Re: What's wrong with this sentence?
- Next by Date: Re: ArrayStoreException when a thick java client invokes Webservice
- Previous by thread: Scheduled task using timer
- Next by thread: Java technologies
- Index(es):
Relevant Pages
|