Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

timer.scheduleAtFixedRate can stack?

PatchaMay 20 2012 — edited May 22 2012
Hi all, I'm using the following code in the <tt>main()</tt> of a <tt>Frame</tt> extending class:
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimedRefresh(), 50, 50);
The question is: how can I be sure that the task will not repeat itself after 50 millis, before the old call of "<tt>run()</tt>" ends up calculations?

Praticall in the run() there are stuffs which can take different time to be made, so I don't wanna lower the time it repeats the task.
But when it takes longer, I wanna be sure a new task will not being started.

<tt>Timer</tt> and <tt>TimedRefresh</tt> already supports this?

Thank you!
This post has been answered by EJP on May 22 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2012
Added on May 20 2012
12 comments
462 views