RFR: 8176499: Dependence on java.util.Timer freezes screen when OS time resets backwards
github.com+12861109+dellgreen at openjdk.java.net
Thu Feb 20 11:24:39 UTC 2020
On Thu, 20 Feb 2020 10:37:34 GMT, littlefreaky <github.com+1434627+littlefreaky at openjdk.org> wrote:
>>> I don't see any stray commits, so it looks like your branch is based off of master correctly.
>>> One thing I would ask you to change is that the title of this PR should exactly match the title of the JBS bug. So can you change it to:
>>> 8176499: Dependence on java.util.Timer freezes screen when OS time resets backwards
>> apologies, all done
> 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.
More information about the openjfx-dev