我如何在运行时更改计时器的周期?
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
// read new period
period = getPeriod();
doSomething();
}
}, 0, period);
ScheduledExecutorService
。 - mre