Browse Source

分布式锁,eception处理,打印日志

dev
wxz 3 years ago
parent
commit
0e9c770f24
  1. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -57,7 +58,8 @@ public class NoRepeatSubmitAop {
//因为getLock如果获取失败抛异常 所以不做锁状态的判断 //因为getLock如果获取失败抛异常 所以不做锁状态的判断
} }
} catch (Exception e) { } catch (Exception e) {
log.warn("noRepeatSubmit key:{},msg:{}", key, e.getMessage()); String error = ExceptionUtils.getErrorStackTrace(e);
log.warn("noRepeatSubmit key:{},msg:{}", key, error);
//"未获取到锁,重复提交了 //"未获取到锁,重复提交了
throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode()); throw new RenException(EpmetErrorCode.REPEAT_SUBMIT.getCode());
} }

Loading…
Cancel
Save