Skip to content

Commit

Permalink
Ensures time compensation is not less than checkpointRestoreTimeDelta
Browse files Browse the repository at this point in the history
Ensure the time compensation in milliseconds is not less than the
checkpoint restore time delta.

Signed-off-by: Jason Feng <fengj@ca.ibm.com>
  • Loading branch information
JasonFengJ9 committed Oct 30, 2023
1 parent f215a7e commit 2b3ffeb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/java.base/share/classes/java/util/Timer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2b3ffeb

Please sign in to comment.