RFR: 8176499: Dependence on java.util.Timer freezes screen when OS time resets backwards

littlefreaky github.com+1434627+littlefreaky at openjdk.java.net
Thu Feb 20 11:43:53 UTC 2020

On Thu, 20 Feb 2020 11:22:28 GMT, Dell Green <github.com+12861109+dellgreen at openjdk.org> wrote:

>> I have a question about the scheduling of the task: 
>> The old code used Timer.schedule(TimerTask,long,long) which schedules the task for repeated fixed-delay execution.
>> The new code uses ScheduledThreadPoolExecutor.scheduleAtFixedRate​(Runnable, long, long, TimeUnit) which schedules the task for repeated fixed-rate execution.
>> Now I think that scheduling at fixed rate would be the correct way as we want to reach 60 pulses per second. But my question is: Can this lead to problems if the work done per pulse takes longer than 16ms? The scheduleAtFixedRate does queue subsequent executions if the previous task takes too long. Couldn't this lead to an task queue overflow if the system is overloaded? Do we need to add protection for that scenario?
> I may be wrong, but looking at the source code for both java.util.Timer.java and ScheduledThreadPoolExecutor.java, they both appear to grow their respective queues if needs be. So i don't think the proposed solution is any worse in that respect.

Ok. Thanks for the clarification.


PR: https://git.openjdk.java.net/jfx/pull/117

More information about the openjfx-dev mailing list