Use the scheduleAtFixedRate() method of the java.util.Timer class:
int initialDelay = 30000; // start after 30 seconds
int period = 5000; // repeat every 5 seconds
Timer timer = new Timer();
TimerTask task = new TimerTask() {
public void run() {
// job code here
}
};
timer.scheduleAtFixedRate(task, initialDelay, period);URL:http://www.jguru.com/faq/view.jsp?EID=99038
No comments:
Post a Comment