Computing.Net > Forums > Programming > Java Programming Issue

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java Programming Issue

Reply to Message Icon

Name: vertigo84
Date: April 24, 2004 at 07:11:44 Pacific
OS: XP Pro
CPU/Ram: 2200 Athlon, 512 DDR
Comment:

This is probably something simple i'm missing, but i have written a program that will take a raw data file, and convert it to HTML and output the the webpages. This needs to happen every hour, as other software updates the raw data logs. My problem is that I can not make my java program wait in the background until each new hour roles around. My program essentially needs to run forever, obtaining the raw file and processing it about 5 minutes after the hour. Does anybody have a suggestion for this. I tried just using a while loop that checks the Date class for the time, but the CPU resourse usage is maxed, which is not good



Sponsored Link
Ads by Google

Response Number 1
Name: tl1_mossman2
Date: April 24, 2004 at 20:44:03 Pacific
Reply:

i would advise using a while loop to put it in infinite loop, and then, using Thread.sleep(int)
... think length is measured in thousandths of a second, but, could be wrong


another option, if ye'r running linux, you can create a cron job to call the java prog once an hour at five minutes after


0

Response Number 2
Name: gpp
Date: April 25, 2004 at 16:02:51 Pacific
Reply:

If you're running windows, then use an AT job. Having a program 'run forever' and check the date is really not an ideal solution.


0

Response Number 3
Name: wharfie
Date: April 26, 2004 at 19:12:36 Pacific
Reply:

Another approach would be to use a Java Timer and a TimerTask.

http://java.sun.com/docs/books/tutorial/essential/threads/timer.html

You can create a Timer to run as a daemon thread.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Java Programming Issue

Please help with java program. www.computing.net/answers/programming/please-help-with-java-program/14834.html

help on java programming www.computing.net/answers/programming/help-on-java-programming/3347.html

Read MS Access using Java program www.computing.net/answers/programming/read-ms-access-using-java-program/3986.html