You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ScheduledThreadPoolExecutor has four schedule methods:
schedule(Runnable command, long delay, TimeUnit unit)
schedule(Callable<V> callable, long delay, TimeUnit unit)
scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit)
scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit)
long triggerTime(long delay) [1] uses System.nanoTime() for delayed time calculation.
The scheduled task is to be added into super.getQueue() for later run which is in the super class ThreadPoolExecutor.
ThreadPoolExecutor main worker run loop is runWorker(Worker w) -> getTask() -> workQueue.poll(keepAliveTime, TimeUnit.NANOSECONDS). workQueue is an instance of BlockingQueue which could be one of concert classes ArrayBlockingQueue, DelayQueue, LinkedBlockingQueue, PriorityBlockingQueue, ScheduledThreadPoolExecutor & SynchronousQueue.
All these classes implement poll(long timeout, TimeUnit unit) -> Condition.awaitNanos(nanos) except SynchronousQueue,
Condition.awaitNanos(nanos) -> ReentrantLock.Sync.newCondition()awaitNanos(nanos) -> AbstractQueuedSynchronizer.awaitNanos(long nanosTimeout) which uses System.nanoTime().
The code path using System.nanoTime() can take advantage of #15016 and ignore the JVM downtime between checkpoint and restore. SynchronousQueue.poll(long timeout, TimeUnit unit) -> transferer.transfer(null, true, unit.toNanos(timeout)) -> awaitFulfill(s, timed, nanos) which uses System.nanoTime() as well.
So it appears ScheduledThreadPoolExecutor & ThreadPoolExecutor could ignore the JVM downtime and run the scheduled tasks normally. This will be verified through some tests.
On the other hand, ForkJoinPool top-level runloop for workers is runWorker(WorkQueue w) using System.currentTimeMillis() which is known sensitive to the downtime between checkpoint/restore. A JCL patch is required to support CRIU JVM.
Add tests to verify the behaviour of:
The text was updated successfully, but these errors were encountered: