修改多节点同时执行任务情况

This commit is contained in:
sh
2026-04-02 17:46:02 +08:00
parent 10a28b1b0b
commit c2b62fac6d
3 changed files with 46 additions and 5 deletions

View File

@@ -48,7 +48,7 @@ public class SysJobServiceImpl implements ISysJobService
public void init() throws SchedulerException, TaskException
{
try (DistributedLockUtil.AutoReleaseLock autoLock =
distributedLockUtil.tryLock(JOB_INIT_LOCK_KEY, LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
distributedLockUtil.tryLockJob(JOB_INIT_LOCK_KEY, LOCK_ACQUIRE_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
if (autoLock == null || !autoLock.isLocked()) {
System.out.println("【定时任务初始化】其他实例已持有锁,当前实例跳过初始化");
return;