I used java.util with a one-time interval to run a timer space at a fixed time. Timer.scheduleAtFixedRate () TimerTask takes 6 hours. The timer accepts this task to start at the same time the next day. But after some time the work is restarted as soon as it closes after the period. I have not seen any pattern of this opportunity, it is just randomly, I have tried this application by running it several times, but have not identified any particular pattern.
Something like that.
class app {public static zero main (last string [] args) {timer timer = new timer (); ProcessManagerTask processManager = new ProcessManagerTask () timer.scheduleAtFixedRate (Process Manager, today @ 01 p.m., 1440 min)) / Some arguments to keep this argument forever}} Public Square ProcessManagerTask TimerTask Extended {Public ProcessManagerTask () {// End time = today @ 7 AM} run public null () {while (expiry time has not expired) {// some stuff}} Processor Manager Task 7 Restarts (when the work is over).
EDIT: People think that I still can not understand why the problem is visible for the timer.
Edit [08 April 2011]: The problem of the boys with the timer is still not resolved. If someone can help you, then I appreciate it.
From Docs:
If any execution (for example) Garbage collection or other background activity), there will be two or more executions in fast succession for "hold".
Therefore, it will appear that your work was not executed at 1 am, so it was executed twice.
Comments
Post a Comment