aspose file tools*
The moose likes Java in General and the fly likes Need a program in timer schedule.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need a program in timer schedule.." Watch "Need a program in timer schedule.." New topic
Author

Need a program in timer schedule..

sridhar Ranganathan
Greenhorn

Joined: Feb 06, 2008
Posts: 29
Hi,
I need a timer schedule program for executing daily basic task.
time :- 5:30 AM

Thanks,
Sridhar.R
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3646
    
  15
Take a look at the Timer and TimerTask classes.


Joanne
Thomas Bennett
Greenhorn

Joined: Jan 09, 2007
Posts: 12
Look at the java.util.Timer class along with TimerTask
Nikhil Jain
Ranch Hand

Joined: May 15, 2005
Posts: 385


SCJP 1.4, SCWCD 1.4, SCBCD 1.5
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39396
    
  28
You might be up and about at 5:30 am, but I'm not. Please check how many 0s you have after 864; if that's milliseconds then I think you have 2hrs 24min, ie 0.1 day.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19719
    
  20

I usually opt for letting the OS schedule those kinds of tasks. Window's task scheduler or Linux' / Unix' cron work just fine for me.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
Instead of coding a literal constant (8640000) that no one knows the value of or why its being used, why not code an expression with all its terms to make it obvious what the number means. For exampel: 24*7*1000 or whatever.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19719
    
  20

Even better, make it a constant with the calculation in it:
public static final int DAY_IN_MILLIS = 24 * 60 * 60 * 1000;

That way, you get the clarity, plus its evaluated by the compiler and stored as 86,400,000 in the class file.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need a program in timer schedule..