How to change the way that timer schedules in TimerTask?
- by Judking
Here is the code snippet:
Timer t = new Timer();
TimerTask task = new TimerTask() {
@Override
public void run() {
//change the timer rate of scheduleAtFixedRate here
}
};
//every 10 sec
t.scheduleAtFixedRate(task, new Date(), 10000);
Could anyone tell me how to change the rate of timer to t.scheduleAtFixedRate(task, new Date(), 30000) in method run from TimerTask instance?
Thanks a lot!