This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Using Timer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using Timer" Watch "Using Timer" New topic
Author

Using Timer

john mattucci
Ranch Hand

Joined: Nov 03, 2000
Posts: 331
I wish to run a certain task every night at midnight. I was wondering if someone could tell me if my code is correct.




I posted this in the java beginner forum, however nobody answered my question. Was hoping that someone could help me here.

Thank you for your time
[ September 08, 2006: Message edited by: john mattucci ]
Ray Stojonic
Ranch Hand

Joined: Aug 08, 2003
Posts: 326
It looks good except that I think you should probably use scheduleAtFixedRate instead in order to maintain your 0:00:00 execution time (otherwise the start time can drift towards times when people will be using the system, assuming that's why you want to start at midnight).
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Using Timer
 
Similar Threads
error while using Timer ....
Using Timer
Web Page to Excel Sheet
Ending a thread from jsp
Simple schedule