I have created a class foo that extends TimerTask and I schedule it
with java.util.Timer.ScheduleAtFixe�dRate() to schedule it. the problem
is that once the timer starts scheduling and i change system date and
time it behaves quite abnormally and starts firing every moment.
Any one knows a way arround this??
In fixed-rate execution, each execution is scheduled relative to the scheduled execution time of the initial execution. If an execution is delayed for any reason (such as garbage collection or other background activity), two or more executions will occur in rapid succession to "catch up." In the long run, the frequency of execution will be exactly the reciprocal of the specified period (assuming the system clock underlying Object.wait(long) is accurate).
In any case, you should not be playing with the Time if you expect the Timer class to behave correctly... however, the schedule() with fix delay option doesn't have this problem.