修改cus日志输出范围,分布式锁新增添加新增失败可能是其他服务器抢占的逻辑控制

main
youHong.ai 2022-12-11 22:57:35 +08:00
parent 2d4bce9513
commit 8e8b6376e6
2 changed files with 10 additions and 2 deletions

View File

@ -2080,6 +2080,7 @@ public class Util extends weaver.general.Util {
appender.setAppend(true); appender.setAppend(true);
appender.activateOptions(); appender.activateOptions();
log.addAppender(appender); log.addAppender(appender);
log.setAdditivity(false);
log.setLevel(Level.INFO); log.setLevel(Level.INFO);
/* /*
boolean enableDebug = false; boolean enableDebug = false;
@ -2127,6 +2128,7 @@ public class Util extends weaver.general.Util {
appender.setAppend(true); appender.setAppend(true);
appender.activateOptions(); appender.activateOptions();
cusLog.addAppender(appender); cusLog.addAppender(appender);
cusLog.setAdditivity(false);
/* /*
boolean enableDebug = false; boolean enableDebug = false;
try { try {

View File

@ -242,8 +242,14 @@ public class LockUtils {
.build(); .build();
LOCK_MAP.put(lockName, lockEntity); LOCK_MAP.put(lockName, lockEntity);
} else { } else {
// 锁失败 LockPojo lockPojo = mapper.selectLock(lockName);
retryLock(dataId, lockName, expirationTime, 0); if (Objects.isNull(lockPojo)) {
// 锁失败
retryLock(dataId, lockName, expirationTime, 0);
} else {
// 其他服务器抢占了锁资源
return retryGetLock(lockName, overdueTime, lockPojo);
}
} }
return true; return true;
} }