This is an automated email from the ASF dual-hosted git repository.
ptupitsyn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new d657dd37615 IGNITE-27628 Shut down FastTimestamps scheduled executor
when interrupted (#7510)
d657dd37615 is described below
commit d657dd37615e90db4c645df1c17746b1afb04fe5
Author: Pavel Tupitsyn <[email protected]>
AuthorDate: Tue Feb 3 14:57:09 2026 +0200
IGNITE-27628 Shut down FastTimestamps scheduled executor when interrupted
(#7510)
---
modules/core/build.gradle | 2 ++
.../ignite/internal/util/FastTimestamps.java | 22 +++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/modules/core/build.gradle b/modules/core/build.gradle
index 36b76dc70f6..19e1e2cc0a9 100644
--- a/modules/core/build.gradle
+++ b/modules/core/build.gradle
@@ -23,6 +23,8 @@ apply from: "$rootDir/buildscripts/java-test-fixtures.gradle"
description = 'ignite-core'
dependencies {
+ compileOnly libs.spotbugs.annotations
+
implementation libs.jetbrains.annotations
implementation libs.fastutil.core
implementation libs.caffeine
diff --git
a/modules/core/src/main/java/org/apache/ignite/internal/util/FastTimestamps.java
b/modules/core/src/main/java/org/apache/ignite/internal/util/FastTimestamps.java
index 2a6019bc405..ccd977851f0 100644
---
a/modules/core/src/main/java/org/apache/ignite/internal/util/FastTimestamps.java
+++
b/modules/core/src/main/java/org/apache/ignite/internal/util/FastTimestamps.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.util;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -27,6 +28,8 @@ import java.util.concurrent.TimeUnit;
public class FastTimestamps {
private static volatile long coarseCurrentTimeMillis =
System.currentTimeMillis();
+ private static volatile boolean interrupted = false;
+
/** The interval in milliseconds for updating a timestamp cache. */
private static final long UPDATE_INTERVAL_MS = 10;
@@ -35,13 +38,30 @@ public class FastTimestamps {
}
private static void startUpdater() {
+ @SuppressWarnings("resource")
ScheduledExecutorService scheduledExecutor =
Executors.newSingleThreadScheduledExecutor(r -> {
- Thread t = new Thread(r, "FastTimestamps updater");
+ @SuppressWarnings("ClassExplicitlyExtendsThread")
+ Thread t = new Thread(r, "FastTimestamps updater") {
+ @Override
+ @SuppressFBWarnings(value =
"ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Updater is static")
+ public void interrupt() {
+ // Support scenarios like "mvn exec:java
`-Dexec.cleanupDaemonThreads=true`"
+ // that expect daemon threads to exit when interrupted.
+ //noinspection AssignmentToStaticFieldFromInstanceMethod
+ interrupted = true;
+ super.interrupt();
+ }
+ };
t.setDaemon(true);
return t;
});
Runnable updaterTask = () -> {
+ if (interrupted) {
+ scheduledExecutor.shutdown();
+ return;
+ }
+
long now = System.currentTimeMillis();
if (now > coarseCurrentTimeMillis) {