This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
This is a known problem with fixed rate scheduling. See JavaDoc...
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.