Page 1 of 1

JaVA Scheduling a Timer Task to Run Repeatedly

PostPosted: Wed Jul 25, 2012 3:23 pm
by haretu
JAVA Scheduling a Timer Task to Run Repeatedly
Code: Select all
int delay = 5000;   // delay for 5 sec.
int period = 1000;  // repeat every sec.
Timer timer = new Timer();

timer.scheduleAtFixedRate(new TimerTask() {
        public void run() {
            // Task here ...
        }
    }, de