Originally posted by Rob Prime:
That has one drawback - you're stuck to the existing schedule. If you want to shift the schedule by a few seconds (a.k.a. restart it starting from now), or have a new schedule, you will have no other choice but to cancel and reschedule. If it only matters that the task occurs regularly with a fixed interval, then skipping is a good solution.
I guess we are drifting a bit from the OP's question, but would having each task be scheduled as a single-execution task that re-schedules itself at the end of the run method solve this? Instead of having the Timer control the delay, you would have a stored or calculated delay inside the TimerTask. At the end of the run you timer.schedule(this,delay) for the next occurence.
Which gives you the flexibility to use a flag to skip a cycle, an instance variable to modify schedules, and another flag to prevent rescheduling.