aspose file tools*
The moose likes Beginning Java and the fly likes TimerTask set to 1 day Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "TimerTask set to 1 day" Watch "TimerTask set to 1 day" New topic
Author

TimerTask set to 1 day

Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Hi,

I have used timertask code that will run at a specified minutes. But now I am thinking if this code
will be ok?



I am not sure if I set the execution period to at least a day will have no problem.
As per my reading and google in the internet, they suggest some sort of scheduling framework such as quartz
to do what I want.

But given just below code, do you think it still is dependable to execute my timertask in 1 day period?
I plan to use this only in windows?

Please advise.


Sean Clark ---> I love this place!!!
Me ------> I definitely love this place!!!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

It will run once each day on roughly the same time, except when daylight savings time kicks in. A day will then have either 23 or 25 hours, not 24.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mark Reyes
Ranch Hand

Joined: Jul 09, 2007
Posts: 426
Hi Rob,

Thanks for your replies..

That is what I want, have it run exactly the same time the next day. No problem if it might be delayed as long as it runs with no problem.

I have used timertask before but the interval that I set are small and runs about an hour. This time I used 24 hour as my period so I am
not sure if in the long run there will be no problem.

Also, I have check the Timer API and have found the scheduleAtFixedRate method. I was thinking that this is the right method that I need instead of the
schedule method.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

Like I said before, daylight savings time will shift your schedule back once a year and back once a year. I'm sure that scheduling frameworks like Quartz have solved this already.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TimerTask set to 1 day