How to change the way that timer schedules in TimerTask?
Posted
by
Judking
on Stack Overflow
See other posts from Stack Overflow
or by Judking
Published on 2013-10-19T03:43:26Z
Indexed on
2013/10/19
3:53 UTC
Read the original article
Hit count: 151
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!
© Stack Overflow or respective owner