diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/lock/AbstractMonitoredLock.java b/fe/fe-core/src/main/java/org/apache/doris/common/lock/AbstractMonitoredLock.java index fbe1a10e8d63a7..7389ed0d61b6b2 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/lock/AbstractMonitoredLock.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/lock/AbstractMonitoredLock.java @@ -30,8 +30,7 @@ * a specified timeout. */ public abstract class AbstractMonitoredLock { - // Lock hold timeout in milliseconds - protected static final long HOLD_TIMEOUT = Config.max_lock_hold_threshold_seconds * 1000; + private static final Logger LOG = LoggerFactory.getLogger(AbstractMonitoredLock.class); // Thread-local variable to store the lock start time @@ -55,12 +54,12 @@ protected void afterUnlock() { if (startTime != null) { long lockHoldTimeNanos = System.nanoTime() - startTime; long lockHoldTimeMs = lockHoldTimeNanos >> 20; - if (lockHoldTimeMs > HOLD_TIMEOUT) { + if (lockHoldTimeMs > Config.max_lock_hold_threshold_seconds * 1000) { Thread currentThread = Thread.currentThread(); String stackTrace = getThreadStackTrace(currentThread.getStackTrace()); LOG.warn("Thread ID: {}, Thread Name: {} - Lock held for {} ms, exceeding hold timeout of {} ms " + "Thread stack trace:{}", - currentThread.getId(), currentThread.getName(), lockHoldTimeMs, HOLD_TIMEOUT, stackTrace); + currentThread.getId(), currentThread.getName(), lockHoldTimeMs, lockHoldTimeMs, stackTrace); } lockStartTime.remove(); }