From 2b3ffebf50d528ee8c0a3c1dde8516a2b9d667ec Mon Sep 17 00:00:00 2001 From: Jason Feng Date: Tue, 24 Oct 2023 18:09:49 -0400 Subject: [PATCH] Ensures time compensation is not less than checkpointRestoreTimeDelta Ensure the time compensation in milliseconds is not less than the checkpoint restore time delta. Signed-off-by: Jason Feng --- src/java.base/share/classes/java/util/Timer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/java.base/share/classes/java/util/Timer.java b/src/java.base/share/classes/java/util/Timer.java index f29e1955bfc..a78ac662d38 100644 --- a/src/java.base/share/classes/java/util/Timer.java +++ b/src/java.base/share/classes/java/util/Timer.java @@ -588,7 +588,9 @@ private void mainLoop() { // A zero checkpointRestoreTimeDelta value indicates no Checkpoint performed yet, // it can't be negative, otherwise a RestoreException already was thrown. if (checkpointRestoreTimeDelta > 0) { + // Ensure the time compensation in milliseconds is not less than the checkpoint restore time delta. task.nextExecutionTime += (checkpointRestoreTimeDelta / 1000000); + task.nextExecutionTime += ((checkpointRestoreTimeDelta % 1000000 == 0) ? 0 : 1); // clear the flag - only one time adjustment required task.criuAdjustRequired = false; }