lsh
2026-04-21 b60ecc7f25ed10848faaf050f071168a85b9e1f0
src/main/java/com/zy/core/task/MainProcessAsyncTaskScheduler.java
@@ -46,6 +46,7 @@
                return false;
            }
            taskGuard.lastSubmitTimeMs = now;
            taskGuard.lastQueueEnterTimeMs = now;
        }
        try {
@@ -64,6 +65,7 @@
                             TaskGuard taskGuard,
                             Runnable task) {
        long startMs = System.currentTimeMillis();
        long queueWaitMs = taskGuard.lastQueueEnterTimeMs > 0L ? startMs - taskGuard.lastQueueEnterTimeMs : 0L;
        try {
            task.run();
        } catch (Exception e) {
@@ -71,7 +73,7 @@
        } finally {
            long costMs = System.currentTimeMillis() - startMs;
            if (slowLogThresholdMs > 0L && costMs > slowLogThresholdMs) {
                log.warn("MainProcess async task executed slowly, lane={}, task={}, cost={}ms", laneName, taskName, costMs);
                log.warn("MainProcess async task executed slowly, lane={}, task={}, cost={}ms, queueWaitMs={}ms", laneName, taskName, costMs, queueWaitMs);
            }
            taskGuard.running.set(false);
        }
@@ -137,6 +139,7 @@
        private final AtomicBoolean running = new AtomicBoolean(false);
        private volatile long lastSubmitTimeMs = 0L;
        private volatile long lastQueueEnterTimeMs = 0L;
    }
    private static class NamedThreadFactory implements ThreadFactory {