Periodically doing "stuff", how do I...

I am working on a senior design program at NCSU and need some help. I am writing a program that will periodically retrieve data from several different counters attached to motion sensors and then update a database with these counts on an hourly basis.

What I need to know as of right now is some info on how to periodically do "stuff". This "stuff" is serial I/O and database updates. The details on my "stuff" are not what I am looking for within this post.

I basically need to know how to make my program do "stuff", wait a specified amount of time, do more "stuff", wait a specified amount of time, etc...

Threads? Sleep? I don't think that I need to accomplish this work via threads because I don't need concurrent "stuff" being done. I will retrieve my data from one counter at time.

Any help you have to offer will be greatly appreciated.

[886 byte] By [spacebass5000] at [2007-9-27 0:13:37]
# 1
java.util.Timer and java.util.TimerTaskBe sure to catch all exceptions in TimerTask.run() otherwise your timer will exit when exceptions are thrown.
daney at 2007-7-4 15:14:06 > top of Java-index,Core,Core APIs...
# 2
Woohoo! Thanks man! Wow, what a fast response!
spacebass5000 at 2007-7-4 15:14:07 > top of Java-index,Core,Core APIs...
# 3
more efficient to have a tight loop that uses timeInMillis, but timer and timertask will normally suffice if performance isnt an issue..rob,
Abuse at 2007-7-4 15:14:07 > top of Java-index,Core,Core APIs...
# 4
I am curious as to how this would be done. Plz elaborate for me.Thanks!
spacebass5000 at 2007-7-4 15:14:07 > top of Java-index,Core,Core APIs...