Thursday, August 2, 2012

schedule a job in java code

simple way to schedule a job running periodic


Timer timer = new Timer();
long delay = 10 * 60 * 1000; //10 minutes
timer.schedule(new Task(), 0, delay)



class Task extends TimerTask {

public void run() {
               //do the job
        }
}

No comments:

Post a Comment